Make the app header bar more consistent.
- Don't include info link if just came from app info page - include back button on app info page when launched from header Bug: 22203029 Change-Id: I737332a487c41e0a93d161b55659700a1f936844
This commit is contained in:
@@ -17,38 +17,49 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.Fragment;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.android.settings.applications.AppInfoBase;
|
||||||
|
import com.android.settings.applications.InstalledAppDetails;
|
||||||
|
|
||||||
public class AppHeader {
|
public class AppHeader {
|
||||||
|
|
||||||
|
public static final String EXTRA_HIDE_INFO_BUTTON = "hideInfoButton";
|
||||||
|
// constant value that can be used to check return code from sub activity.
|
||||||
|
private static final int INSTALLED_APP_DETAILS = 1;
|
||||||
|
|
||||||
public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
|
public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
|
||||||
CharSequence label, final Intent settingsIntent) {
|
CharSequence label, String pkgName, int uid) {
|
||||||
createAppHeader(fragment, icon, label, settingsIntent, 0);
|
createAppHeader(fragment, icon, label, pkgName, uid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createAppHeader(Activity activity, Drawable icon, CharSequence label,
|
public static void createAppHeader(Activity activity, Drawable icon, CharSequence label,
|
||||||
final Intent settingsIntent, ViewGroup pinnedHeader) {
|
String pkgName, int uid, ViewGroup pinnedHeader) {
|
||||||
final View bar = activity.getLayoutInflater().inflate(R.layout.app_header,
|
final View bar = activity.getLayoutInflater().inflate(R.layout.app_header,
|
||||||
pinnedHeader, false);
|
pinnedHeader, false);
|
||||||
setupHeaderView(activity, icon, label, settingsIntent, 0, bar);
|
setupHeaderView(activity, icon, label, pkgName, uid, false, 0, bar);
|
||||||
pinnedHeader.addView(bar);
|
pinnedHeader.addView(bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
|
public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
|
||||||
CharSequence label, Intent settingsIntent, int tintColorRes) {
|
CharSequence label, String pkgName, int uid, int tintColorRes) {
|
||||||
View bar = fragment.setPinnedHeaderView(R.layout.app_header);
|
View bar = fragment.setPinnedHeaderView(R.layout.app_header);
|
||||||
setupHeaderView(fragment.getActivity(), icon, label, settingsIntent, tintColorRes, bar);
|
setupHeaderView(fragment.getActivity(), icon, label, pkgName, uid, includeAppInfo(fragment),
|
||||||
|
tintColorRes, bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static View setupHeaderView(final Activity activity, Drawable icon, CharSequence label,
|
private static View setupHeaderView(final Activity activity, Drawable icon, CharSequence label,
|
||||||
final Intent settingsIntent, int tintColorRes, View bar) {
|
final String pkgName, final int uid, boolean includeAppInfo, int tintColorRes,
|
||||||
|
View bar) {
|
||||||
final ImageView appIcon = (ImageView) bar.findViewById(R.id.app_icon);
|
final ImageView appIcon = (ImageView) bar.findViewById(R.id.app_icon);
|
||||||
appIcon.setImageDrawable(icon);
|
appIcon.setImageDrawable(icon);
|
||||||
if (tintColorRes != 0) {
|
if (tintColorRes != 0) {
|
||||||
@@ -59,19 +70,32 @@ public class AppHeader {
|
|||||||
appName.setText(label);
|
appName.setText(label);
|
||||||
|
|
||||||
final View appSettings = bar.findViewById(R.id.app_settings);
|
final View appSettings = bar.findViewById(R.id.app_settings);
|
||||||
if (settingsIntent == null) {
|
if (includeAppInfo && pkgName != null && !pkgName.equals(Utils.OS_PKG)) {
|
||||||
appSettings.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
appSettings.setClickable(true);
|
appSettings.setClickable(true);
|
||||||
appSettings.setOnClickListener(new OnClickListener() {
|
appSettings.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
activity.startActivity(settingsIntent);
|
AppInfoBase.startAppInfoFragment(InstalledAppDetails.class,
|
||||||
|
R.string.application_info_label, pkgName, uid, activity,
|
||||||
|
INSTALLED_APP_DETAILS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
appSettings.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bar;
|
return bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean includeAppInfo(final Fragment fragment) {
|
||||||
|
Bundle args = fragment.getArguments();
|
||||||
|
boolean showInfo = true;
|
||||||
|
if (args != null && args.getBoolean(EXTRA_HIDE_INFO_BUTTON, false)) {
|
||||||
|
showInfo = false;
|
||||||
|
}
|
||||||
|
Intent intent = fragment.getActivity().getIntent();
|
||||||
|
if (intent != null && intent.getBooleanExtra(EXTRA_HIDE_INFO_BUTTON, false)) {
|
||||||
|
showInfo = false;
|
||||||
|
}
|
||||||
|
return showInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -486,8 +486,9 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
// When we are going straight to an app then we are coming from App Info and want
|
// When we are going straight to an app then we are coming from App Info and want
|
||||||
// a header at the top.
|
// a header at the top.
|
||||||
FrameLayout pinnedHeader = (FrameLayout) rootView.findViewById(R.id.pinned_header);
|
FrameLayout pinnedHeader = (FrameLayout) rootView.findViewById(R.id.pinned_header);
|
||||||
AppHeader.createAppHeader(getActivity(), detail.icon, detail.label, null, pinnedHeader);
|
AppHeader.createAppHeader(getActivity(), detail.icon, detail.label,
|
||||||
AppDetailsFragment.show(DataUsageSummary.this, app, detail.label, true);
|
mShowAppImmediatePkg, uid, pinnedHeader);
|
||||||
|
AppDetailsFragment.show(DataUsageSummary.this, app, detail.label, false);
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
Log.w(TAG, "Could not find " + mShowAppImmediatePkg, e);
|
Log.w(TAG, "Could not find " + mShowAppImmediatePkg, e);
|
||||||
Toast.makeText(getActivity(), getString(R.string.unknown_app), Toast.LENGTH_LONG)
|
Toast.makeText(getActivity(), getString(R.string.unknown_app), Toast.LENGTH_LONG)
|
||||||
|
@@ -195,13 +195,18 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
public static void startAppInfoFragment(Class<?> fragment, int titleRes,
|
public static void startAppInfoFragment(Class<?> fragment, int titleRes,
|
||||||
String pkg, int uid, Fragment source, int request) {
|
String pkg, int uid, Fragment source, int request) {
|
||||||
|
startAppInfoFragment(fragment, titleRes, pkg, uid, source.getActivity(), request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void startAppInfoFragment(Class<?> fragment, int titleRes,
|
||||||
|
String pkg, int uid, Activity source, int request) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkg);
|
args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkg);
|
||||||
args.putInt(AppInfoBase.ARG_PACKAGE_UID, uid);
|
args.putInt(AppInfoBase.ARG_PACKAGE_UID, uid);
|
||||||
|
|
||||||
Intent intent = Utils.onBuildStartFragmentIntent(source.getActivity(), fragment.getName(),
|
Intent intent = Utils.onBuildStartFragmentIntent(source, fragment.getName(),
|
||||||
args, null, titleRes, null, false);
|
args, null, titleRes, null, false);
|
||||||
source.getActivity().startActivityForResultAsUser(intent, request,
|
source.startActivityForResultAsUser(intent, request,
|
||||||
new UserHandle(UserHandle.getUserId(uid)));
|
new UserHandle(UserHandle.getUserId(uid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,19 +16,13 @@
|
|||||||
|
|
||||||
package com.android.settings.applications;
|
package com.android.settings.applications;
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.settings.AppHeader;
|
import com.android.settings.AppHeader;
|
||||||
|
|
||||||
public abstract class AppInfoWithHeader extends AppInfoBase {
|
public abstract class AppInfoWithHeader extends AppInfoBase {
|
||||||
|
|
||||||
public static final String EXTRA_HIDE_INFO_BUTTON = "hideInfoButton";
|
|
||||||
|
|
||||||
private boolean mCreated;
|
private boolean mCreated;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -41,24 +35,7 @@ public abstract class AppInfoWithHeader extends AppInfoBase {
|
|||||||
mCreated = true;
|
mCreated = true;
|
||||||
if (mPackageInfo == null) return;
|
if (mPackageInfo == null) return;
|
||||||
AppHeader.createAppHeader(this, mPackageInfo.applicationInfo.loadIcon(mPm),
|
AppHeader.createAppHeader(this, mPackageInfo.applicationInfo.loadIcon(mPm),
|
||||||
mPackageInfo.applicationInfo.loadLabel(mPm), getInfoIntent(this, mPackageName), 0);
|
mPackageInfo.applicationInfo.loadLabel(mPm), mPackageName,
|
||||||
}
|
mPackageInfo.applicationInfo.uid, 0);
|
||||||
|
|
||||||
public static Intent getInfoIntent(Fragment fragment, String packageName) {
|
|
||||||
Bundle args = fragment.getArguments();
|
|
||||||
Intent intent = fragment.getActivity().getIntent();
|
|
||||||
boolean showInfo = true;
|
|
||||||
if (args != null && args.getBoolean(EXTRA_HIDE_INFO_BUTTON, false)) {
|
|
||||||
showInfo = false;
|
|
||||||
}
|
|
||||||
if (intent != null && intent.getBooleanExtra(EXTRA_HIDE_INFO_BUTTON, false)) {
|
|
||||||
showInfo = false;
|
|
||||||
}
|
|
||||||
Intent infoIntent = null;
|
|
||||||
if (showInfo) {
|
|
||||||
infoIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
||||||
infoIntent.setData(Uri.fromParts("package", packageName, null));
|
|
||||||
}
|
|
||||||
return infoIntent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,6 +67,7 @@ import android.widget.TextView;
|
|||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.os.BatterySipper;
|
import com.android.internal.os.BatterySipper;
|
||||||
import com.android.internal.os.BatteryStatsHelper;
|
import com.android.internal.os.BatteryStatsHelper;
|
||||||
|
import com.android.settings.AppHeader;
|
||||||
import com.android.settings.DataUsageSummary;
|
import com.android.settings.DataUsageSummary;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
@@ -680,7 +681,7 @@ public class InstalledAppDetails extends AppInfoBase
|
|||||||
// start new activity to manage app permissions
|
// start new activity to manage app permissions
|
||||||
Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
|
Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
|
||||||
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mAppEntry.info.packageName);
|
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mAppEntry.info.packageName);
|
||||||
intent.putExtra(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
intent.putExtra(AppHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
||||||
try {
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
@@ -693,7 +694,7 @@ public class InstalledAppDetails extends AppInfoBase
|
|||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(ARG_PACKAGE_NAME, mAppEntry.info.packageName);
|
args.putString(ARG_PACKAGE_NAME, mAppEntry.info.packageName);
|
||||||
args.putInt(ARG_PACKAGE_UID, mAppEntry.info.uid);
|
args.putInt(ARG_PACKAGE_UID, mAppEntry.info.uid);
|
||||||
args.putBoolean(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
args.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, true);
|
||||||
|
|
||||||
SettingsActivity sa = (SettingsActivity) getActivity();
|
SettingsActivity sa = (SettingsActivity) getActivity();
|
||||||
sa.startPreferencePanel(fragment.getName(), args, -1, title, this, SUB_INFO_FRAGMENT);
|
sa.startPreferencePanel(fragment.getName(), args, -1, title, this, SUB_INFO_FRAGMENT);
|
||||||
@@ -742,7 +743,7 @@ public class InstalledAppDetails extends AppInfoBase
|
|||||||
startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle());
|
startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle());
|
||||||
} else if (preference == mMemoryPreference) {
|
} else if (preference == mMemoryPreference) {
|
||||||
ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(),
|
ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(),
|
||||||
mStatsManager.getMemInfo(), mStats);
|
mStatsManager.getMemInfo(), mStats, false);
|
||||||
} else if (preference == mDataPreference) {
|
} else if (preference == mDataPreference) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(DataUsageSummary.EXTRA_SHOW_APP_IMMEDIATE_PKG,
|
args.putString(DataUsageSummary.EXTRA_SHOW_APP_IMMEDIATE_PKG,
|
||||||
@@ -754,7 +755,7 @@ public class InstalledAppDetails extends AppInfoBase
|
|||||||
} else if (preference == mBatteryPreference) {
|
} else if (preference == mBatteryPreference) {
|
||||||
BatteryEntry entry = new BatteryEntry(getActivity(), null, mUserManager, mSipper);
|
BatteryEntry entry = new BatteryEntry(getActivity(), null, mUserManager, mSipper);
|
||||||
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(),
|
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(),
|
||||||
mBatteryHelper, BatteryStats.STATS_SINCE_CHARGED, entry, true);
|
mBatteryHelper, BatteryStats.STATS_SINCE_CHARGED, entry, true, false);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -363,7 +363,7 @@ public class ManageApplications extends InstrumentedFragment
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
if (mListType == LIST_TYPE_STORAGE) {
|
if (mListType == LIST_TYPE_STORAGE) {
|
||||||
FrameLayout pinnedHeader = (FrameLayout) mRootView.findViewById(R.id.pinned_header);
|
FrameLayout pinnedHeader = (FrameLayout) mRootView.findViewById(R.id.pinned_header);
|
||||||
AppHeader.createAppHeader(getActivity(), null, mVolumeName, null, pinnedHeader);
|
AppHeader.createAppHeader(getActivity(), null, mVolumeName, null, -1, pinnedHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
import com.android.internal.app.ProcessStats;
|
import com.android.internal.app.ProcessStats;
|
||||||
|
import com.android.settings.AppHeader;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
@@ -128,7 +129,7 @@ public abstract class ProcessStatsBase extends SettingsPreferenceFragment
|
|||||||
public abstract void refreshUi();
|
public abstract void refreshUi();
|
||||||
|
|
||||||
public static void launchMemoryDetail(SettingsActivity activity, MemInfo memInfo,
|
public static void launchMemoryDetail(SettingsActivity activity, MemInfo memInfo,
|
||||||
ProcStatsPackageEntry entry) {
|
ProcStatsPackageEntry entry, boolean includeAppInfo) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable(ProcessStatsDetail.EXTRA_PACKAGE_ENTRY, entry);
|
args.putParcelable(ProcessStatsDetail.EXTRA_PACKAGE_ENTRY, entry);
|
||||||
args.putDouble(ProcessStatsDetail.EXTRA_WEIGHT_TO_RAM, memInfo.weightToRam);
|
args.putDouble(ProcessStatsDetail.EXTRA_WEIGHT_TO_RAM, memInfo.weightToRam);
|
||||||
@@ -136,6 +137,7 @@ public abstract class ProcessStatsBase extends SettingsPreferenceFragment
|
|||||||
args.putDouble(ProcessStatsDetail.EXTRA_MAX_MEMORY_USAGE,
|
args.putDouble(ProcessStatsDetail.EXTRA_MAX_MEMORY_USAGE,
|
||||||
memInfo.usedWeight * memInfo.weightToRam);
|
memInfo.usedWeight * memInfo.weightToRam);
|
||||||
args.putDouble(ProcessStatsDetail.EXTRA_TOTAL_SCALE, memInfo.totalScale);
|
args.putDouble(ProcessStatsDetail.EXTRA_TOTAL_SCALE, memInfo.totalScale);
|
||||||
|
args.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, !includeAppInfo);
|
||||||
activity.startPreferencePanel(ProcessStatsDetail.class.getName(), args,
|
activity.startPreferencePanel(ProcessStatsDetail.class.getName(), args,
|
||||||
R.string.memory_usage, null, null, 0);
|
R.string.memory_usage, null, null, 0);
|
||||||
}
|
}
|
||||||
|
@@ -121,8 +121,7 @@ public class ProcessStatsDetail extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
AppHeader.createAppHeader(this,
|
AppHeader.createAppHeader(this,
|
||||||
mApp.mUiTargetApp != null ? mApp.mUiTargetApp.loadIcon(mPm) : new ColorDrawable(0),
|
mApp.mUiTargetApp != null ? mApp.mUiTargetApp.loadIcon(mPm) : new ColorDrawable(0),
|
||||||
mApp.mUiLabel, mApp.mPackage.equals(Utils.OS_PKG) ? null
|
mApp.mUiLabel, mApp.mPackage, mApp.mUiTargetApp.uid);
|
||||||
: AppInfoWithHeader.getInfoIntent(this, mApp.mPackage));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -108,7 +108,7 @@ public class ProcessStatsUi extends ProcessStatsBase {
|
|||||||
}
|
}
|
||||||
ProcessStatsPreference pgp = (ProcessStatsPreference) preference;
|
ProcessStatsPreference pgp = (ProcessStatsPreference) preference;
|
||||||
MemInfo memInfo = mStatsManager.getMemInfo();
|
MemInfo memInfo = mStatsManager.getMemInfo();
|
||||||
launchMemoryDetail((SettingsActivity) getActivity(), memInfo, pgp.getEntry());
|
launchMemoryDetail((SettingsActivity) getActivity(), memInfo, pgp.getEntry(), true);
|
||||||
|
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
|||||||
|
|
||||||
public static void startBatteryDetailPage(
|
public static void startBatteryDetailPage(
|
||||||
SettingsActivity caller, BatteryStatsHelper helper, int statsType, BatteryEntry entry,
|
SettingsActivity caller, BatteryStatsHelper helper, int statsType, BatteryEntry entry,
|
||||||
boolean showLocationButton) {
|
boolean showLocationButton, boolean includeAppInfo) {
|
||||||
// Initialize mStats if necessary.
|
// Initialize mStats if necessary.
|
||||||
helper.getStats();
|
helper.getStats();
|
||||||
|
|
||||||
@@ -104,6 +104,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
|||||||
}
|
}
|
||||||
args.putSerializable(PowerUsageDetail.EXTRA_DRAIN_TYPE, entry.sipper.drainType);
|
args.putSerializable(PowerUsageDetail.EXTRA_DRAIN_TYPE, entry.sipper.drainType);
|
||||||
args.putBoolean(PowerUsageDetail.EXTRA_SHOW_LOCATION_BUTTON, showLocationButton);
|
args.putBoolean(PowerUsageDetail.EXTRA_SHOW_LOCATION_BUTTON, showLocationButton);
|
||||||
|
args.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, !includeAppInfo);
|
||||||
|
|
||||||
int userId = UserHandle.myUserId();
|
int userId = UserHandle.myUserId();
|
||||||
int[] types;
|
int[] types;
|
||||||
@@ -462,13 +463,15 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
|||||||
String pkg = args.getString(EXTRA_ICON_PACKAGE);
|
String pkg = args.getString(EXTRA_ICON_PACKAGE);
|
||||||
int iconId = args.getInt(EXTRA_ICON_ID, 0);
|
int iconId = args.getInt(EXTRA_ICON_ID, 0);
|
||||||
Drawable appIcon = null;
|
Drawable appIcon = null;
|
||||||
|
int uid = -1;
|
||||||
|
final PackageManager pm = getActivity().getPackageManager();
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(pkg)) {
|
if (!TextUtils.isEmpty(pkg)) {
|
||||||
try {
|
try {
|
||||||
final PackageManager pm = getActivity().getPackageManager();
|
|
||||||
ApplicationInfo ai = pm.getPackageInfo(pkg, 0).applicationInfo;
|
ApplicationInfo ai = pm.getPackageInfo(pkg, 0).applicationInfo;
|
||||||
if (ai != null) {
|
if (ai != null) {
|
||||||
appIcon = ai.loadIcon(pm);
|
appIcon = ai.loadIcon(pm);
|
||||||
|
uid = ai.uid;
|
||||||
}
|
}
|
||||||
} catch (NameNotFoundException nnfe) {
|
} catch (NameNotFoundException nnfe) {
|
||||||
// Use default icon
|
// Use default icon
|
||||||
@@ -483,8 +486,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
|||||||
if (pkg == null && mPackages != null) {
|
if (pkg == null && mPackages != null) {
|
||||||
pkg = mPackages[0];
|
pkg = mPackages[0];
|
||||||
}
|
}
|
||||||
AppHeader.createAppHeader(this, appIcon, title,
|
AppHeader.createAppHeader(this, appIcon, title, pkg, uid,
|
||||||
pkg != null ? AppInfoWithHeader.getInfoIntent(this, pkg) : null,
|
|
||||||
mDrainType != DrainType.APP ? android.R.color.white : 0);
|
mDrainType != DrainType.APP ? android.R.color.white : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@ import com.android.settings.HelpUtils;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Settings.HighPowerApplicationsActivity;
|
import com.android.settings.Settings.HighPowerApplicationsActivity;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.applications.ManageApplications;
|
import com.android.settings.applications.ManageApplications;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -123,7 +124,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
|||||||
PowerGaugePreference pgp = (PowerGaugePreference) preference;
|
PowerGaugePreference pgp = (PowerGaugePreference) preference;
|
||||||
BatteryEntry entry = pgp.getInfo();
|
BatteryEntry entry = pgp.getInfo();
|
||||||
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(), mStatsHelper,
|
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(), mStatsHelper,
|
||||||
mStatsType, entry, true);
|
mStatsType, entry, true, true);
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,6 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.applications.AppInfoBase;
|
import com.android.settings.applications.AppInfoBase;
|
||||||
import com.android.settings.applications.AppInfoWithHeader;
|
|
||||||
import com.android.settings.notification.NotificationBackend.AppRow;
|
import com.android.settings.notification.NotificationBackend.AppRow;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -86,8 +85,7 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
mCreated = true;
|
mCreated = true;
|
||||||
if (mAppRow == null) return;
|
if (mAppRow == null) return;
|
||||||
AppHeader.createAppHeader(this, mAppRow.icon, mAppRow.label,
|
AppHeader.createAppHeader(this, mAppRow.icon, mAppRow.label, mAppRow.pkg, mAppRow.uid);
|
||||||
AppInfoWithHeader.getInfoIntent(this, mAppRow.pkg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user