Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f20d39e8 authored by Zoltan Szatmary-Ban's avatar Zoltan Szatmary-Ban
Browse files

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
parent f34c3501
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -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) {