Merge "Fix issue 7198767, 7198366, 7189824." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f4bd1a705f
@@ -2706,6 +2706,8 @@
|
|||||||
<string name="service_process_name"><xliff:g id="process">%1$s</xliff:g></string>
|
<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 -->
|
<!-- [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>
|
<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. -->
|
<!-- 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>
|
<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>
|
process and <xliff:g id="numservices">%2$d</xliff:g> service</string>
|
||||||
|
@@ -18,6 +18,7 @@ import android.os.Looper;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.text.format.Formatter;
|
import android.text.format.Formatter;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -238,6 +239,7 @@ public class ApplicationsState {
|
|||||||
|
|
||||||
final Context mContext;
|
final Context mContext;
|
||||||
final PackageManager mPm;
|
final PackageManager mPm;
|
||||||
|
final int mRetrieveFlags;
|
||||||
PackageIntentReceiver mPackageIntentReceiver;
|
PackageIntentReceiver mPackageIntentReceiver;
|
||||||
|
|
||||||
boolean mResumed;
|
boolean mResumed;
|
||||||
@@ -402,6 +404,14 @@ public class ApplicationsState {
|
|||||||
mThread.start();
|
mThread.start();
|
||||||
mBackgroundHandler = new BackgroundHandler(mThread.getLooper());
|
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.
|
* This is a trick to prevent the foreground thread from being delayed.
|
||||||
* The problem is that Dalvik monitors are initially spin locks, to keep
|
* The problem is that Dalvik monitors are initially spin locks, to keep
|
||||||
@@ -591,9 +601,7 @@ public class ApplicationsState {
|
|||||||
mPackageIntentReceiver = new PackageIntentReceiver();
|
mPackageIntentReceiver = new PackageIntentReceiver();
|
||||||
mPackageIntentReceiver.registerReceiver();
|
mPackageIntentReceiver.registerReceiver();
|
||||||
}
|
}
|
||||||
mApplications = mPm.getInstalledApplications(
|
mApplications = mPm.getInstalledApplications(mRetrieveFlags);
|
||||||
PackageManager.GET_UNINSTALLED_PACKAGES |
|
|
||||||
PackageManager.GET_DISABLED_COMPONENTS);
|
|
||||||
if (mApplications == null) {
|
if (mApplications == null) {
|
||||||
mApplications = new ArrayList<ApplicationInfo>();
|
mApplications = new ArrayList<ApplicationInfo>();
|
||||||
}
|
}
|
||||||
@@ -723,9 +731,7 @@ public class ApplicationsState {
|
|||||||
if (DEBUG_LOCKING) Log.v(TAG, "addPackage release lock: already exists");
|
if (DEBUG_LOCKING) Log.v(TAG, "addPackage release lock: already exists");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ApplicationInfo info = mPm.getApplicationInfo(pkgName,
|
ApplicationInfo info = mPm.getApplicationInfo(pkgName, mRetrieveFlags);
|
||||||
PackageManager.GET_UNINSTALLED_PACKAGES |
|
|
||||||
PackageManager.GET_DISABLED_COMPONENTS);
|
|
||||||
mApplications.add(info);
|
mApplications.add(info);
|
||||||
if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) {
|
if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) {
|
||||||
mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES);
|
mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES);
|
||||||
|
@@ -340,7 +340,8 @@ public class InstalledAppDetails extends Fragment
|
|||||||
}
|
}
|
||||||
} else if ((mPackageInfo.applicationInfo.flags
|
} else if ((mPackageInfo.applicationInfo.flags
|
||||||
& ApplicationInfo.FLAG_INSTALLED) == 0) {
|
& ApplicationInfo.FLAG_INSTALLED) == 0) {
|
||||||
mUninstallButton.setText(R.string.install_text);
|
mUninstallButton.setText(R.string.uninstall_text);
|
||||||
|
enabled = false;
|
||||||
} else {
|
} else {
|
||||||
mUninstallButton.setText(R.string.uninstall_text);
|
mUninstallButton.setText(R.string.uninstall_text);
|
||||||
}
|
}
|
||||||
@@ -392,6 +393,9 @@ public class InstalledAppDetails extends Fragment
|
|||||||
|
|
||||||
mCanBeOnSdCardChecker = new CanBeOnSdCardChecker();
|
mCanBeOnSdCardChecker = new CanBeOnSdCardChecker();
|
||||||
|
|
||||||
|
// Need to make sure we have loaded applications at this point.
|
||||||
|
mSession.resume();
|
||||||
|
|
||||||
retrieveAppEntry();
|
retrieveAppEntry();
|
||||||
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
@@ -1134,6 +1138,7 @@ public class InstalledAppDetails extends Fragment
|
|||||||
Uri.fromParts("package", mAppEntry.info.packageName, null));
|
Uri.fromParts("package", mAppEntry.info.packageName, null));
|
||||||
intent.putExtra(Intent.EXTRA_PACKAGES, new String[] { mAppEntry.info.packageName });
|
intent.putExtra(Intent.EXTRA_PACKAGES, new String[] { mAppEntry.info.packageName });
|
||||||
intent.putExtra(Intent.EXTRA_UID, mAppEntry.info.uid);
|
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,
|
getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null,
|
||||||
Activity.RESULT_CANCELED, null, null);
|
Activity.RESULT_CANCELED, null, null);
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.applications;
|
package com.android.settings.applications;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.users.UserUtils;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
@@ -377,7 +378,8 @@ public class RunningState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ApplicationInfo ai = pm.getApplicationInfo(mProcessName, 0);
|
ApplicationInfo ai = pm.getApplicationInfo(mProcessName,
|
||||||
|
PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
if (ai.uid == mUid) {
|
if (ai.uid == mUid) {
|
||||||
mDisplayLabel = ai.loadLabel(pm);
|
mDisplayLabel = ai.loadLabel(pm);
|
||||||
mLabel = mDisplayLabel.toString();
|
mLabel = mDisplayLabel.toString();
|
||||||
@@ -394,7 +396,8 @@ public class RunningState {
|
|||||||
// If there is one package with this uid, that is what we want.
|
// If there is one package with this uid, that is what we want.
|
||||||
if (pkgs.length == 1) {
|
if (pkgs.length == 1) {
|
||||||
try {
|
try {
|
||||||
ApplicationInfo ai = pm.getApplicationInfo(pkgs[0], 0);
|
ApplicationInfo ai = pm.getApplicationInfo(pkgs[0],
|
||||||
|
PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
mDisplayLabel = ai.loadLabel(pm);
|
mDisplayLabel = ai.loadLabel(pm);
|
||||||
mLabel = mDisplayLabel.toString();
|
mLabel = mDisplayLabel.toString();
|
||||||
mPackageInfo = ai;
|
mPackageInfo = ai;
|
||||||
@@ -435,7 +438,8 @@ public class RunningState {
|
|||||||
|
|
||||||
// Finally... whatever, just pick the first package's name.
|
// Finally... whatever, just pick the first package's name.
|
||||||
try {
|
try {
|
||||||
ApplicationInfo ai = pm.getApplicationInfo(pkgs[0], 0);
|
ApplicationInfo ai = pm.getApplicationInfo(pkgs[0],
|
||||||
|
PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
mDisplayLabel = ai.loadLabel(pm);
|
mDisplayLabel = ai.loadLabel(pm);
|
||||||
mLabel = mDisplayLabel.toString();
|
mLabel = mDisplayLabel.toString();
|
||||||
mPackageInfo = ai;
|
mPackageInfo = ai;
|
||||||
@@ -455,7 +459,8 @@ public class RunningState {
|
|||||||
si = new ServiceItem(mUserId);
|
si = new ServiceItem(mUserId);
|
||||||
si.mRunningService = service;
|
si.mRunningService = service;
|
||||||
try {
|
try {
|
||||||
si.mServiceInfo = pm.getServiceInfo(service.service, 0);
|
si.mServiceInfo = pm.getServiceInfo(service.service,
|
||||||
|
PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
}
|
}
|
||||||
si.mDisplayLabel = makeLabel(pm,
|
si.mDisplayLabel = makeLabel(pm,
|
||||||
@@ -818,12 +823,9 @@ public class RunningState {
|
|||||||
userItem.mUser = new UserState();
|
userItem.mUser = new UserState();
|
||||||
UserInfo info = mUm.getUserInfo(newItem.mUserId);
|
UserInfo info = mUm.getUserInfo(newItem.mUserId);
|
||||||
userItem.mUser.mInfo = info;
|
userItem.mUser.mInfo = info;
|
||||||
if (info != null && info.iconPath != null) {
|
if (info != null) {
|
||||||
try {
|
userItem.mUser.mIcon = UserUtils.getUserIcon(mUm, info,
|
||||||
userItem.mUser.mIcon = Drawable.createFromPath(info.iconPath);
|
context.getResources());
|
||||||
} catch (Exception e) {
|
|
||||||
Log.w(TAG, "Failure loading user picture " + info.iconPath, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
String name = info != null ? info.name : null;
|
String name = info != null ? info.name : null;
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
@@ -34,6 +34,7 @@ import android.graphics.drawable.Drawable;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -455,6 +456,7 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener
|
|||||||
Uri.fromParts("package", mPackages[0], null));
|
Uri.fromParts("package", mPackages[0], null));
|
||||||
intent.putExtra(Intent.EXTRA_PACKAGES, mPackages);
|
intent.putExtra(Intent.EXTRA_PACKAGES, mPackages);
|
||||||
intent.putExtra(Intent.EXTRA_UID, mUid);
|
intent.putExtra(Intent.EXTRA_UID, mUid);
|
||||||
|
intent.putExtra(Intent.EXTRA_USER_HANDLE, mUid);
|
||||||
getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null,
|
getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null,
|
||||||
Activity.RESULT_CANCELED, null, null);
|
Activity.RESULT_CANCELED, null, null);
|
||||||
}
|
}
|
||||||
|
@@ -767,15 +767,23 @@ public class PowerUsageSummary extends PreferenceFragment implements Runnable {
|
|||||||
final int userId = mUserSippers.keyAt(i);
|
final int userId = mUserSippers.keyAt(i);
|
||||||
final List<BatterySipper> sippers = mUserSippers.valueAt(i);
|
final List<BatterySipper> sippers = mUserSippers.valueAt(i);
|
||||||
UserInfo info = mUm.getUserInfo(userId);
|
UserInfo info = mUm.getUserInfo(userId);
|
||||||
Drawable icon = UserUtils.getUserIcon(mUm, info, getResources());
|
Drawable icon;
|
||||||
String name = info != null ? info.name : null;
|
String name;
|
||||||
if (name == null) {
|
if (info != null) {
|
||||||
name = Integer.toString(info.id);
|
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);
|
double power = mUserPower.get(userId);
|
||||||
String label = getActivity().getResources().getString(
|
BatterySipper bs = addEntry(name, DrainType.USER, 0, 0, power);
|
||||||
R.string.running_process_item_user_label, name);
|
|
||||||
BatterySipper bs = addEntry(label, DrainType.USER, 0, 0, power);
|
|
||||||
bs.icon = icon;
|
bs.icon = icon;
|
||||||
aggregateSippers(bs, sippers, "User");
|
aggregateSippers(bs, sippers, "User");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user