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

Commit ddf85f1b authored by Manjeet Rulhania's avatar Manjeet Rulhania Committed by Android (Google) Code Review
Browse files

Merge "Adding check in requestPermissions for pre M apps" into main

parents 97605df9 6e4a6a66
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -5770,6 +5770,11 @@ public class Activity extends ContextThemeWrapper
    @FlaggedApi(Flags.FLAG_DEVICE_AWARE_PERMISSION_APIS_ENABLED)
    public final void requestPermissions(@NonNull String[] permissions, int requestCode,
            int deviceId) {
        // Pre M apps shouldn't request permissions, as permissions are granted at install time.
        if (getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.M) {
            onRequestPermissionsResult(requestCode, new String[0], new int[0], deviceId);
        }

        if (requestCode < 0) {
            throw new IllegalArgumentException("requestCode should be >= 0");
        }