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
This commit is contained in:
Zoltan Szatmary-Ban
2014-08-07 15:27:08 +01:00
parent f34c350194
commit f20d39e87d

View File

@@ -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) {