diff options
author | Amith Yamasani <yamasani@google.com> | 2012-03-22 16:16:17 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2012-03-27 11:23:01 -0700 |
commit | 135936072b24b090fb63940aea41b408d855a4f3 (patch) | |
tree | c10e6a7642df4246937bb6fbd7277b642daf3eee /services/java/com/android/server/AppWidgetService.java | |
parent | 0c44525a4888de321c9497204d59c8515f828499 (diff) | |
download | frameworks_base-135936072b24b090fb63940aea41b408d855a4f3.zip frameworks_base-135936072b24b090fb63940aea41b408d855a4f3.tar.gz frameworks_base-135936072b24b090fb63940aea41b408d855a4f3.tar.bz2 |
User management and switching
Broadcast intents that get sent out when users are added/removed/switched.
More work on generating user-specific information in package manager queries.
APIs to update user name and query a user by id.
Removed Package.mSetStopped and mSetEnabled, since they're not user specific.
User removal:
- Cleanup ActivityManager, PackageManager, WallpaperManager, AppWidgetService
and AccountManager.
- Shutdown processes belonging to the user.
Don't show vibrate option in long-press power if there's no vibrator.
Lock the screen when switching users, to force unlocking.
Change-Id: Ib23a721cb75285eef5fd6ba8c7272462764038fa
Diffstat (limited to 'services/java/com/android/server/AppWidgetService.java')
-rw-r--r-- | services/java/com/android/server/AppWidgetService.java | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index a85b605..eb024e9 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -170,6 +170,15 @@ class AppWidgetService extends IAppWidgetService.Stub sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); mContext.registerReceiver(mBroadcastReceiver, sdFilter); + + IntentFilter userFilter = new IntentFilter(); + userFilter.addAction(Intent.ACTION_USER_REMOVED); + mContext.registerReceiver(new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + onUserRemoved(intent.getIntExtra(Intent.EXTRA_USERID, -1)); + } + }, userFilter); } @Override @@ -192,19 +201,6 @@ class AppWidgetService extends IAppWidgetService.Stub getImplForUser().deleteAllHosts(); } - void cancelBroadcasts(Provider p) { - if (p.broadcast != null) { - mAlarmManager.cancel(p.broadcast); - long token = Binder.clearCallingIdentity(); - try { - p.broadcast.cancel(); - } finally { - Binder.restoreCallingIdentity(token); - } - p.broadcast = null; - } - } - @Override public void bindAppWidgetId(int appWidgetId, ComponentName provider) throws RemoteException { getImplForUser().bindAppWidgetId(appWidgetId, provider); @@ -222,8 +218,15 @@ class AppWidgetService extends IAppWidgetService.Stub return getImplForUser().startListening(host, packageName, hostId, updatedViews); } - // TODO: Call this from PackageManagerService when a user is removed - public void removeUser(int userId) { + public void onUserRemoved(int userId) { + AppWidgetServiceImpl impl = mAppWidgetServices.get(userId); + if (userId < 1) return; + + if (impl == null) { + AppWidgetServiceImpl.getSettingsFile(userId).delete(); + } else { + impl.onUserRemoved(); + } } private AppWidgetServiceImpl getImplForUser() { |