diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-02-10 10:38:10 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-02-10 10:54:15 -0800 |
commit | 21fbd1f7da53dc044737803dccddf8099f1fc1e9 (patch) | |
tree | e8de991996e1a5df738066683f6c5124efa33a9d | |
parent | d10035d52bcd4eed9f83cad580d606cd522dd6c7 (diff) | |
download | frameworks_base-21fbd1f7da53dc044737803dccddf8099f1fc1e9.zip frameworks_base-21fbd1f7da53dc044737803dccddf8099f1fc1e9.tar.gz frameworks_base-21fbd1f7da53dc044737803dccddf8099f1fc1e9.tar.bz2 |
Some cruft removal.
Change-Id: If4a94bfd4a033748eb13e8f3ff25e24382746778
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | api/16.txt | 2 | ||||
-rw-r--r-- | api/current.txt | 2 | ||||
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 61 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 12 | ||||
-rw-r--r-- | core/java/android/app/IActivityWatcher.aidl | 27 | ||||
-rw-r--r-- | core/java/android/os/Process.java | 2 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 76 | ||||
-rw-r--r-- | services/java/com/android/server/pm/PackageManagerService.java | 25 | ||||
-rw-r--r-- | services/java/com/android/server/pm/Settings.java | 34 |
10 files changed, 30 insertions, 212 deletions
@@ -67,7 +67,6 @@ LOCAL_SRC_FILES += \ core/java/android/accounts/IAccountAuthenticatorResponse.aidl \ core/java/android/app/IActivityController.aidl \ core/java/android/app/IActivityPendingResult.aidl \ - core/java/android/app/IActivityWatcher.aidl \ core/java/android/app/IAlarmManager.aidl \ core/java/android/app/IBackupAgent.aidl \ core/java/android/app/IInstrumentationWatcher.aidl \ @@ -15052,7 +15052,7 @@ package android.os { method public static final deprecated boolean supportsProcesses(); field public static final int BLUETOOTH_GID = 2000; // 0x7d0 field public static final int FIRST_APPLICATION_UID = 10000; // 0x2710 - field public static final int LAST_APPLICATION_UID = 89999; // 0x1869f + field public static final int LAST_APPLICATION_UID = 19999; // 0x1869f field public static final int PHONE_UID = 1001; // 0x3e9 field public static final int SIGNAL_KILL = 9; // 0x9 field public static final int SIGNAL_QUIT = 3; // 0x3 diff --git a/api/current.txt b/api/current.txt index 2037515..8a46d96 100644 --- a/api/current.txt +++ b/api/current.txt @@ -15180,7 +15180,7 @@ package android.os { method public static final deprecated boolean supportsProcesses(); field public static final int BLUETOOTH_GID = 2000; // 0x7d0 field public static final int FIRST_APPLICATION_UID = 10000; // 0x2710 - field public static final int LAST_APPLICATION_UID = 89999; // 0x15f8f + field public static final int LAST_APPLICATION_UID = 19999; // 0x4e1f field public static final int PHONE_UID = 1001; // 0x3e9 field public static final int SIGNAL_KILL = 9; // 0x9 field public static final int SIGNAL_QUIT = 3; // 0x3 diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index d80902d..dfea728 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -554,15 +554,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } - case FINISH_OTHER_INSTANCES_TRANSACTION: { - data.enforceInterface(IActivityManager.descriptor); - IBinder token = data.readStrongBinder(); - ComponentName className = ComponentName.readFromParcel(data); - finishOtherInstances(token, className); - reply.writeNoException(); - return true; - } - case REPORT_THUMBNAIL_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); @@ -1192,22 +1183,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } - case REGISTER_ACTIVITY_WATCHER_TRANSACTION: { - data.enforceInterface(IActivityManager.descriptor); - IActivityWatcher watcher = IActivityWatcher.Stub.asInterface( - data.readStrongBinder()); - registerActivityWatcher(watcher); - return true; - } - - case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: { - data.enforceInterface(IActivityManager.descriptor); - IActivityWatcher watcher = IActivityWatcher.Stub.asInterface( - data.readStrongBinder()); - unregisterActivityWatcher(watcher); - return true; - } - case START_ACTIVITY_IN_PACKAGE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); @@ -2164,18 +2139,6 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return res; } - public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException - { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - data.writeStrongBinder(token); - ComponentName.writeToParcel(className, data); - mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0); - reply.readException(); - data.recycle(); - reply.recycle(); - } public void reportThumbnail(IBinder token, Bitmap thumbnail, CharSequence description) throws RemoteException { @@ -3024,30 +2987,6 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); } - public void registerActivityWatcher(IActivityWatcher watcher) - throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); - mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0); - reply.readException(); - data.recycle(); - reply.recycle(); - } - - public void unregisterActivityWatcher(IActivityWatcher watcher) - throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); - mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0); - reply.readException(); - data.recycle(); - reply.recycle(); - } - public int startActivityInPackage(int uid, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, boolean onlyIfNeeded) diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 39817ac..a62f724 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -145,7 +145,6 @@ public interface IActivityManager extends IInterface { public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException; public void moveTaskBackwards(int task) throws RemoteException; public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException; - public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException; /* oneway */ public void reportThumbnail(IBinder token, Bitmap thumbnail, CharSequence description) throws RemoteException; @@ -295,11 +294,6 @@ public interface IActivityManager extends IInterface { public void stopAppSwitches() throws RemoteException; public void resumeAppSwitches() throws RemoteException; - public void registerActivityWatcher(IActivityWatcher watcher) - throws RemoteException; - public void unregisterActivityWatcher(IActivityWatcher watcher) - throws RemoteException; - public int startActivityInPackage(int uid, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, boolean onlyIfNeeded) @@ -505,7 +499,7 @@ public interface IActivityManager extends IInterface { int BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35; int UNBIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36; int PUBLISH_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37; - int FINISH_OTHER_INSTANCES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+38; + int GOING_TO_SLEEP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+39; int WAKING_UP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+40; int SET_DEBUG_APP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+41; @@ -559,8 +553,8 @@ public interface IActivityManager extends IInterface { int START_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+89; int BACKUP_AGENT_CREATED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+90; int UNBIND_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+91; - int REGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+92; - int UNREGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+93; + + int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94; int KILL_APPLICATION_WITH_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95; int CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96; diff --git a/core/java/android/app/IActivityWatcher.aidl b/core/java/android/app/IActivityWatcher.aidl deleted file mode 100644 index 6737545..0000000 --- a/core/java/android/app/IActivityWatcher.aidl +++ /dev/null @@ -1,27 +0,0 @@ -/* -** -** Copyright 2009, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -package android.app; - -/** - * Callback interface to watch the user's traversal through activities. - * {@hide} - */ -oneway interface IActivityWatcher { - void activityResuming(int activityId); - void closingSystemDialogs(String reason); -} diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 0746af8..6139296 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -119,7 +119,7 @@ public class Process { * Last of application-specific UIDs starting at * {@link #FIRST_APPLICATION_UID}. */ - public static final int LAST_APPLICATION_UID = 89999; + public static final int LAST_APPLICATION_UID = 19999; /** * First uid used for fully isolated sandboxed processes (with no permissions of their own) diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index a110dd6..e38d96e 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -38,7 +38,6 @@ import android.app.AppGlobals; import android.app.ApplicationErrorReport; import android.app.Dialog; import android.app.IActivityController; -import android.app.IActivityWatcher; import android.app.IApplicationThread; import android.app.IInstrumentationWatcher; import android.app.INotificationManager; @@ -1560,9 +1559,6 @@ public final class ActivityManagerService extends ActivityManagerNative int mProfileType = 0; boolean mAutoStopProfiler = false; - final RemoteCallbackList<IActivityWatcher> mWatchers - = new RemoteCallbackList<IActivityWatcher>(); - final RemoteCallbackList<IProcessObserver> mProcessObservers = new RemoteCallbackList<IProcessObserver>(); @@ -3020,19 +3016,6 @@ public final class ActivityManagerService extends ActivityManagerNative final int identHash = System.identityHashCode(r); updateUsageStats(r, true); - - int i = mWatchers.beginBroadcast(); - while (i > 0) { - i--; - IActivityWatcher w = mWatchers.getBroadcastItem(i); - if (w != null) { - try { - w.activityResuming(identHash); - } catch (RemoteException e) { - } - } - } - mWatchers.finishBroadcast(); } private void dispatchForegroundActivitiesChanged(int pid, int uid, boolean foregroundActivities) { @@ -4239,22 +4222,9 @@ public final class ActivityManagerService extends ActivityManagerNative final int uid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); synchronized (this) { - int i = mWatchers.beginBroadcast(); - while (i > 0) { - i--; - IActivityWatcher w = mWatchers.getBroadcastItem(i); - if (w != null) { - try { - w.closingSystemDialogs(reason); - } catch (RemoteException e) { - } - } - } - mWatchers.finishBroadcast(); - mWindowManager.closeSystemDialogs(reason); - for (i=mMainStack.mHistory.size()-1; i>=0; i--) { + for (int i=mMainStack.mHistory.size()-1; i>=0; i--) { ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i); if ((r.info.flags&ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS) != 0) { r.stack.finishActivityLocked(r, i, @@ -6497,30 +6467,6 @@ public final class ActivityManagerService extends ActivityManagerNative return -1; } - public void finishOtherInstances(IBinder token, ComponentName className) { - enforceNotIsolatedCaller("finishOtherInstances"); - synchronized(this) { - final long origId = Binder.clearCallingIdentity(); - - int N = mMainStack.mHistory.size(); - TaskRecord lastTask = null; - for (int i=0; i<N; i++) { - ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i); - if (r.realActivity.equals(className) - && r.appToken != token && lastTask != r.task) { - if (r.stack.finishActivityLocked(r, i, Activity.RESULT_CANCELED, - null, "others")) { - i--; - N--; - } - } - lastTask = r.task; - } - - Binder.restoreCallingIdentity(origId); - } - } - // ========================================================= // THUMBNAILS // ========================================================= @@ -7520,28 +7466,20 @@ public final class ActivityManagerService extends ActivityManagerNative } } - public void registerActivityWatcher(IActivityWatcher watcher) { - enforceNotIsolatedCaller("registerActivityWatcher"); + public void registerProcessObserver(IProcessObserver observer) { + enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER, + "registerProcessObserver()"); synchronized (this) { - mWatchers.register(watcher); + mProcessObservers.register(observer); } } - public void unregisterActivityWatcher(IActivityWatcher watcher) { + public void unregisterProcessObserver(IProcessObserver observer) { synchronized (this) { - mWatchers.unregister(watcher); + mProcessObservers.unregister(observer); } } - public void registerProcessObserver(IProcessObserver observer) { - enforceNotIsolatedCaller("registerProcessObserver"); - mProcessObservers.register(observer); - } - - public void unregisterProcessObserver(IProcessObserver observer) { - mProcessObservers.unregister(observer); - } - public void setImmersive(IBinder token, boolean immersive) { synchronized(this) { ActivityRecord r = mMainStack.isInStackLocked(token); diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 38c128c..7169015 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -164,13 +164,9 @@ public class PackageManagerService extends IPackageManager.Stub { private static final boolean DEBUG_APP_DIR_OBSERVER = false; private static final boolean DEBUG_VERIFY = false; - static final boolean MULTIPLE_APPLICATION_UIDS = true; private static final int RADIO_UID = Process.PHONE_UID; private static final int LOG_UID = Process.LOG_UID; private static final int NFC_UID = Process.NFC_UID; - static final int FIRST_APPLICATION_UID = - Process.FIRST_APPLICATION_UID; - static final int MAX_APPLICATION_UIDS = 1000; private static final boolean GET_CERTIFICATES = true; @@ -874,18 +870,9 @@ public class PackageManagerService extends IPackageManager.Stub { mSettings = new Settings(); mSettings.addSharedUserLPw("android.uid.system", Process.SYSTEM_UID, ApplicationInfo.FLAG_SYSTEM); - mSettings.addSharedUserLPw("android.uid.phone", - MULTIPLE_APPLICATION_UIDS - ? RADIO_UID : FIRST_APPLICATION_UID, - ApplicationInfo.FLAG_SYSTEM); - mSettings.addSharedUserLPw("android.uid.log", - MULTIPLE_APPLICATION_UIDS - ? LOG_UID : FIRST_APPLICATION_UID, - ApplicationInfo.FLAG_SYSTEM); - mSettings.addSharedUserLPw("android.uid.nfc", - MULTIPLE_APPLICATION_UIDS - ? NFC_UID : FIRST_APPLICATION_UID, - ApplicationInfo.FLAG_SYSTEM); + mSettings.addSharedUserLPw("android.uid.phone", RADIO_UID, ApplicationInfo.FLAG_SYSTEM); + mSettings.addSharedUserLPw("android.uid.log", LOG_UID, ApplicationInfo.FLAG_SYSTEM); + mSettings.addSharedUserLPw("android.uid.nfc", NFC_UID, ApplicationInfo.FLAG_SYSTEM); String separateProcesses = SystemProperties.get("debug.separate_processes"); if (separateProcesses != null && separateProcesses.length() > 0) { @@ -2274,8 +2261,6 @@ public class PackageManagerService extends IPackageManager.Stub { } } - final int userId = UserId.getUserId(Binder.getCallingUid()); - if (comp != null) { final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1); final ActivityInfo ai = getActivityInfo(comp, flags); @@ -6446,10 +6431,6 @@ public class PackageManagerService extends IPackageManager.Stub { // package that we deleted. if(deletedPkg) { File restoreFile = new File(deletedPackage.mPath); - if (restoreFile == null) { - Slog.e(TAG, "Failed allocating storage when restoring pkg : " + pkgName); - return; - } // Parse old package boolean oldOnSd = isExternal(deletedPackage); int oldParseFlags = mDefParseFlags | PackageParser.PARSE_CHATTY | diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java index 3616aa2..fdb6e4c 100644 --- a/services/java/com/android/server/pm/Settings.java +++ b/services/java/com/android/server/pm/Settings.java @@ -200,11 +200,7 @@ final class Settings { return null; } s = new SharedUserSetting(name, pkgFlags); - if (PackageManagerService.MULTIPLE_APPLICATION_UIDS) { - s.userId = newUserIdLPw(s); - } else { - s.userId = PackageManagerService.FIRST_APPLICATION_UID; - } + s.userId = newUserIdLPw(s); Log.i(PackageManagerService.TAG, "New shared user " + name + ": id=" + s.userId); // < 0 means we couldn't assign a userid; fall out and return // s, which is currently null @@ -407,7 +403,7 @@ final class Settings { } if (sharedUser != null) { p.userId = sharedUser.userId; - } else if (PackageManagerService.MULTIPLE_APPLICATION_UIDS) { + } else { // Clone the setting here for disabled system packages PackageSetting dis = mDisabledSysPackages.get(name); if (dis != null) { @@ -430,8 +426,6 @@ final class Settings { // Assign new user id p.userId = newUserIdLPw(p); } - } else { - p.userId = PackageManagerService.FIRST_APPLICATION_UID; } } if (p.userId < 0) { @@ -598,13 +592,13 @@ final class Settings { } private boolean addUserIdLPw(int uid, Object obj, Object name) { - if (uid >= PackageManagerService.FIRST_APPLICATION_UID + PackageManagerService.MAX_APPLICATION_UIDS) { + if (uid > Process.LAST_APPLICATION_UID) { return false; } - if (uid >= PackageManagerService.FIRST_APPLICATION_UID) { + if (uid >= Process.FIRST_APPLICATION_UID) { int N = mUserIds.size(); - final int index = uid - PackageManagerService.FIRST_APPLICATION_UID; + final int index = uid - Process.FIRST_APPLICATION_UID; while (index >= N) { mUserIds.add(null); N++; @@ -629,9 +623,9 @@ final class Settings { } public Object getUserIdLPr(int uid) { - if (uid >= PackageManagerService.FIRST_APPLICATION_UID) { + if (uid >= Process.FIRST_APPLICATION_UID) { final int N = mUserIds.size(); - final int index = uid - PackageManagerService.FIRST_APPLICATION_UID; + final int index = uid - Process.FIRST_APPLICATION_UID; return index < N ? mUserIds.get(index) : null; } else { return mOtherUserIds.get(uid); @@ -639,9 +633,9 @@ final class Settings { } private void removeUserIdLPw(int uid) { - if (uid >= PackageManagerService.FIRST_APPLICATION_UID) { + if (uid >= Process.FIRST_APPLICATION_UID) { final int N = mUserIds.size(); - final int index = uid - PackageManagerService.FIRST_APPLICATION_UID; + final int index = uid - Process.FIRST_APPLICATION_UID; if (index < N) mUserIds.set(index, null); } else { mOtherUserIds.remove(uid); @@ -649,9 +643,9 @@ final class Settings { } private void replaceUserIdLPw(int uid, Object obj) { - if (uid >= PackageManagerService.FIRST_APPLICATION_UID) { + if (uid >= Process.FIRST_APPLICATION_UID) { final int N = mUserIds.size(); - final int index = uid - PackageManagerService.FIRST_APPLICATION_UID; + final int index = uid - Process.FIRST_APPLICATION_UID; if (index < N) mUserIds.set(index, obj); } else { mOtherUserIds.put(uid, obj); @@ -1898,17 +1892,17 @@ final class Settings { for (int i = 0; i < N; i++) { if (mUserIds.get(i) == null) { mUserIds.set(i, obj); - return PackageManagerService.FIRST_APPLICATION_UID + i; + return Process.FIRST_APPLICATION_UID + i; } } // None left? - if (N >= PackageManagerService.MAX_APPLICATION_UIDS) { + if (N > (Process.LAST_APPLICATION_UID-Process.FIRST_APPLICATION_UID)) { return -1; } mUserIds.add(obj); - return PackageManagerService.FIRST_APPLICATION_UID + N; + return Process.FIRST_APPLICATION_UID + N; } public VerifierDeviceIdentity getVerifierDeviceIdentityLPw() { |