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

Commit c90234a3 authored by Paul McLean's avatar Paul McLean
Browse files

Hide "Always Allow" checkbox for "record warning" cases.

This one for the UsbConfirmActivity.

Bug: 145148679
Test: Install UsbAccess App, connect USB audio record device. Note
that the "Always Allow: checkbox is removed.

Change-Id: Iaac385f4640703e93b881eed7ab51e43e3656dd7
parent 40160776
Loading
Loading
Loading
Loading
+19 −17
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public class UsbConfirmActivity extends AlertActivity

        final AlertController.AlertParams ap = mAlertParams;
        ap.mTitle = appName;
        boolean useRecordWarning = false;
        if (mDevice == null) {
            ap.mMessage = getString(R.string.usb_accessory_confirm_prompt, appName,
                    mAccessory.getDescription());
@@ -83,7 +84,7 @@ public class UsbConfirmActivity extends AlertActivity
                            packageName)
                            == android.content.pm.PackageManager.PERMISSION_GRANTED;
            boolean isAudioCaptureDevice = mDevice.getHasAudioCapture();
            boolean useRecordWarning = isAudioCaptureDevice && !hasRecordPermission;
            useRecordWarning = isAudioCaptureDevice && !hasRecordPermission;

            int strID = useRecordWarning
                    ? R.string.usb_device_confirm_prompt_warn
@@ -98,6 +99,7 @@ public class UsbConfirmActivity extends AlertActivity
        ap.mNegativeButtonListener = this;

        // add "always use" checkbox
        if (!useRecordWarning) {
            LayoutInflater inflater = (LayoutInflater) getSystemService(
                    Context.LAYOUT_INFLATER_SERVICE);
            ap.mView = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null);
@@ -113,7 +115,7 @@ public class UsbConfirmActivity extends AlertActivity
            mClearDefaultHint = (TextView) ap.mView.findViewById(
                    com.android.internal.R.id.clearDefaultHint);
            mClearDefaultHint.setVisibility(View.GONE);

        }
        setupAlert();

    }
@@ -133,7 +135,7 @@ public class UsbConfirmActivity extends AlertActivity
                IUsbManager service = IUsbManager.Stub.asInterface(b);
                final int uid = mResolveInfo.activityInfo.applicationInfo.uid;
                final int userId = UserHandle.myUserId();
                boolean alwaysUse = mAlwaysUse.isChecked();
                boolean alwaysUse = mAlwaysUse != null ? mAlwaysUse.isChecked() : false;
                Intent intent = null;

                if (mDevice != null) {