From f20d39e87d7fdabdf17d0b5f49c30bd85dfabefb Mon Sep 17 00:00:00 2001 From: Zoltan Szatmary-Ban Date: Thu, 7 Aug 2014 15:27:08 +0100 Subject: [PATCH] Start activity for the correct user in Settings > Data Usage The 'app settings' button on the app details view now starts the app settings activity for the correct user, i.e. the managed profile's app settings if the list item corresponds to the managed profile's app. Formerly it always incorrectly started up the settings screen for the primary user's app. Bug:16727726 Change-Id: Ib31d45f4201fb26b5231e4e57c49858e7e41efc9 --- .../android/settings/DataUsageSummary.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java index c8691e16cb4..f7a0618e6fb 100644 --- a/src/com/android/settings/DataUsageSummary.java +++ b/src/com/android/settings/DataUsageSummary.java @@ -402,7 +402,6 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable mAppSwitches = (LinearLayout) mAppDetail.findViewById(R.id.app_switches); mAppSettings = (Button) mAppDetail.findViewById(R.id.app_settings); - mAppSettings.setOnClickListener(mAppSettingsListener); mAppRestrict = new Switch(inflater.getContext()); mAppRestrict.setClickable(false); @@ -853,11 +852,24 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable } } + mAppSettings.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + if (!isAdded()) { + return; + } + + // TODO: target towards entire UID instead of just first package + getActivity().startActivityAsUser(mAppSettingsIntent, + new UserHandle(UserHandle.getUserId(uid))); + } + }); mAppSettings.setEnabled(matchFound); mAppSettings.setVisibility(View.VISIBLE); } else { mAppSettingsIntent = null; + mAppSettings.setOnClickListener(null); mAppSettings.setVisibility(View.GONE); } @@ -1110,16 +1122,6 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable } }; - private OnClickListener mAppSettingsListener = new OnClickListener() { - @Override - public void onClick(View v) { - if (!isAdded()) return; - - // TODO: target torwards entire UID instead of just first package - startActivity(mAppSettingsIntent); - } - }; - private OnItemClickListener mListListener = new OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) {