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
This commit is contained in:
Amith Yamasani
2012-03-22 16:16:17 -07:00
parent 0c44525a48
commit 135936072b
22 changed files with 681 additions and 273 deletions

View File

@ -1484,9 +1484,13 @@ class AppWidgetServiceImpl {
}
}
static File getSettingsFile(int userId) {
return new File("/data/system/users/" + userId + "/" + SETTINGS_FILENAME);
}
AtomicFile savedStateFile() {
File dir = new File("/data/system/users/" + mUserId);
File settingsFile = new File(dir, SETTINGS_FILENAME);
File settingsFile = getSettingsFile(mUserId);
if (!dir.exists()) {
dir.mkdirs();
if (mUserId == 0) {
@ -1500,6 +1504,16 @@ class AppWidgetServiceImpl {
return new AtomicFile(settingsFile);
}
void onUserRemoved() {
// prune the ones we don't want to keep
int N = mInstalledProviders.size();
for (int i = N - 1; i >= 0; i--) {
Provider p = mInstalledProviders.get(i);
cancelBroadcasts(p);
}
getSettingsFile(mUserId).delete();
}
void addProvidersForPackageLocked(String pkgName) {
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
intent.setPackage(pkgName);