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

Commit a2e77a0e authored by Raff Tsai's avatar Raff Tsai
Browse files

Fix no action in Settings storage

- Pass wrong user id in view holder

Fixes: 149028747
Test: 1. Add new user, and change th new user
      2. Take a camera shot under the new user
      3. go to Settings -> Storage -> photo & video -> Image
      4. Should open file brower

Change-Id: I0af532748ec19f62897911b1bb6ece9b21b844c3
parent cc781a38
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ public class ManageApplications extends InstrumentedFragment
                mApplications.mHasReceivedBridgeCallback =
                        savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
            }
            int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
            int userId = mIsWorkOnly ? mWorkUserId : UserHandle.myUserId();
            if (mStorageType == STORAGE_TYPE_MUSIC) {
                Context context = getContext();
                mApplications.setExtraViewController(
+1 −20
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static com.android.settings.dashboard.profileselector.ProfileSelectFragme
import static com.android.settings.dashboard.profileselector.ProfileSelectFragment.WORK_TAB;

import android.app.settings.SettingsEnums;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -173,7 +172,7 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
        if (intent != null) {
            intent.putExtra(Intent.EXTRA_USER_ID, mUserId);

            launchIntent(intent);
            Utils.launchIntent(mFragment, intent);
            return true;
        }

@@ -467,24 +466,6 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
        }
    }

    private void launchIntent(Intent intent) {
        try {
            final int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, -1);

            // b/33117269: Note that launchIntent may launch activity in different task which set
            // different launchMode (e.g. Files), using startActivityForesult to set task as
            // source task, and set requestCode as 0 means don't care about returnCode currently.
            if (userId == -1) {
                mFragment.startActivityForResult(intent, 0 /* requestCode not used */);
            } else {
                mFragment.getActivity().startActivityForResultAsUser(intent,
                        0 /* requestCode not used */, new UserHandle(userId));
            }
        } catch (ActivityNotFoundException e) {
            Log.w(TAG, "No activity found for " + intent);
        }
    }

    private static long totalValues(StorageMeasurement.MeasurementDetails details, int userId,
            String... keys) {
        long total = 0;