<string name="service_process_name"><xliff:g id="process">%1$s</xliff:g></string>
<!-- [CHAR LIMIT=NONE] Label of a running process that represents another user -->
<string name="running_process_item_user_label">User: <xliff:g id="user_name">%1$s</xliff:g></string>
+ <!-- [CHAR LIMIT=NONE] Label of a running process that represents a removed -->
+ <string name="running_process_item_removed_user_label">Removed user</string>
<!-- Descriptive text of a running process: singular process, singular service. -->
<string name="running_processes_item_description_s_s"><xliff:g id="numprocess">%1$d</xliff:g>
process and <xliff:g id="numservices">%2$d</xliff:g> service</string>
import android.os.Message;
import android.os.Process;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.text.format.Formatter;
import android.util.Log;
final Context mContext;
final PackageManager mPm;
+ final int mRetrieveFlags;
PackageIntentReceiver mPackageIntentReceiver;
boolean mResumed;
Process.THREAD_PRIORITY_BACKGROUND);
mThread.start();
mBackgroundHandler = new BackgroundHandler(mThread.getLooper());
-
+
+ // Only the owner can see all apps.
+ if (UserHandle.myUserId() == 0) {
+ mRetrieveFlags = PackageManager.GET_UNINSTALLED_PACKAGES |
+ PackageManager.GET_DISABLED_COMPONENTS;
+ } else {
+ mRetrieveFlags = PackageManager.GET_DISABLED_COMPONENTS;
+ }
+
/**
* This is a trick to prevent the foreground thread from being delayed.
* The problem is that Dalvik monitors are initially spin locks, to keep
mPackageIntentReceiver = new PackageIntentReceiver();
mPackageIntentReceiver.registerReceiver();
}
- mApplications = mPm.getInstalledApplications(
- PackageManager.GET_UNINSTALLED_PACKAGES |
- PackageManager.GET_DISABLED_COMPONENTS);
+ mApplications = mPm.getInstalledApplications(mRetrieveFlags);
if (mApplications == null) {
mApplications = new ArrayList<ApplicationInfo>();
}
if (DEBUG_LOCKING) Log.v(TAG, "addPackage release lock: already exists");
return;
}
- ApplicationInfo info = mPm.getApplicationInfo(pkgName,
- PackageManager.GET_UNINSTALLED_PACKAGES |
- PackageManager.GET_DISABLED_COMPONENTS);
+ ApplicationInfo info = mPm.getApplicationInfo(pkgName, mRetrieveFlags);
mApplications.add(info);
if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) {
mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES);
}
} else if ((mPackageInfo.applicationInfo.flags
& ApplicationInfo.FLAG_INSTALLED) == 0) {
- mUninstallButton.setText(R.string.install_text);
+ mUninstallButton.setText(R.string.uninstall_text);
+ enabled = false;
} else {
mUninstallButton.setText(R.string.uninstall_text);
}
mCanBeOnSdCardChecker = new CanBeOnSdCardChecker();
+ // Need to make sure we have loaded applications at this point.
+ mSession.resume();
+
retrieveAppEntry();
setHasOptionsMenu(true);
Uri.fromParts("package", mAppEntry.info.packageName, null));
intent.putExtra(Intent.EXTRA_PACKAGES, new String[] { mAppEntry.info.packageName });
intent.putExtra(Intent.EXTRA_UID, mAppEntry.info.uid);
+ intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(mAppEntry.info.uid));
getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null,
Activity.RESULT_CANCELED, null, null);
}
package com.android.settings.applications;
import com.android.settings.R;
+import com.android.settings.users.UserUtils;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
}
try {
- ApplicationInfo ai = pm.getApplicationInfo(mProcessName, 0);
+ ApplicationInfo ai = pm.getApplicationInfo(mProcessName,
+ PackageManager.GET_UNINSTALLED_PACKAGES);
if (ai.uid == mUid) {
mDisplayLabel = ai.loadLabel(pm);
mLabel = mDisplayLabel.toString();
// If there is one package with this uid, that is what we want.
if (pkgs.length == 1) {
try {
- ApplicationInfo ai = pm.getApplicationInfo(pkgs[0], 0);
+ ApplicationInfo ai = pm.getApplicationInfo(pkgs[0],
+ PackageManager.GET_UNINSTALLED_PACKAGES);
mDisplayLabel = ai.loadLabel(pm);
mLabel = mDisplayLabel.toString();
mPackageInfo = ai;
// Finally... whatever, just pick the first package's name.
try {
- ApplicationInfo ai = pm.getApplicationInfo(pkgs[0], 0);
+ ApplicationInfo ai = pm.getApplicationInfo(pkgs[0],
+ PackageManager.GET_UNINSTALLED_PACKAGES);
mDisplayLabel = ai.loadLabel(pm);
mLabel = mDisplayLabel.toString();
mPackageInfo = ai;
si = new ServiceItem(mUserId);
si.mRunningService = service;
try {
- si.mServiceInfo = pm.getServiceInfo(service.service, 0);
+ si.mServiceInfo = pm.getServiceInfo(service.service,
+ PackageManager.GET_UNINSTALLED_PACKAGES);
} catch (PackageManager.NameNotFoundException e) {
}
si.mDisplayLabel = makeLabel(pm,
userItem.mUser = new UserState();
UserInfo info = mUm.getUserInfo(newItem.mUserId);
userItem.mUser.mInfo = info;
- if (info != null && info.iconPath != null) {
- try {
- userItem.mUser.mIcon = Drawable.createFromPath(info.iconPath);
- } catch (Exception e) {
- Log.w(TAG, "Failure loading user picture " + info.iconPath, e);
- }
+ if (info != null) {
+ userItem.mUser.mIcon = UserUtils.getUserIcon(mUm, info,
+ context.getResources());
}
String name = info != null ? info.name : null;
if (name == null) {
import android.net.Uri;
import android.os.Bundle;
import android.os.Process;
+import android.os.UserHandle;
import android.preference.PreferenceActivity;
import android.provider.Settings;
import android.text.TextUtils;
Uri.fromParts("package", mPackages[0], null));
intent.putExtra(Intent.EXTRA_PACKAGES, mPackages);
intent.putExtra(Intent.EXTRA_UID, mUid);
+ intent.putExtra(Intent.EXTRA_USER_HANDLE, mUid);
getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null,
Activity.RESULT_CANCELED, null, null);
}
final int userId = mUserSippers.keyAt(i);
final List<BatterySipper> sippers = mUserSippers.valueAt(i);
UserInfo info = mUm.getUserInfo(userId);
- Drawable icon = UserUtils.getUserIcon(mUm, info, getResources());
- String name = info != null ? info.name : null;
- if (name == null) {
- name = Integer.toString(info.id);
+ Drawable icon;
+ String name;
+ if (info != null) {
+ icon = UserUtils.getUserIcon(mUm, info, getResources());
+ name = info != null ? info.name : null;
+ if (name == null) {
+ name = Integer.toString(info.id);
+ }
+ name = getActivity().getResources().getString(
+ R.string.running_process_item_user_label, name);
+ } else {
+ icon = null;
+ name = getActivity().getResources().getString(
+ R.string.running_process_item_removed_user_label);
}
double power = mUserPower.get(userId);
- String label = getActivity().getResources().getString(
- R.string.running_process_item_user_label, name);
- BatterySipper bs = addEntry(label, DrainType.USER, 0, 0, power);
+ BatterySipper bs = addEntry(name, DrainType.USER, 0, 0, power);
bs.icon = icon;
aggregateSippers(bs, sippers, "User");
}