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 /services | |
parent | d10035d52bcd4eed9f83cad580d606cd522dd6c7 (diff) | |
download | frameworks_base-21fbd1f7da53dc044737803dccddf8099f1fc1e9.zip frameworks_base-21fbd1f7da53dc044737803dccddf8099f1fc1e9.tar.gz frameworks_base-21fbd1f7da53dc044737803dccddf8099f1fc1e9.tar.bz2 |
Some cruft removal.
Change-Id: If4a94bfd4a033748eb13e8f3ff25e24382746778
Diffstat (limited to 'services')
3 files changed, 24 insertions, 111 deletions
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() { |