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

Unverified Commit 689c0adb authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-13.0.0_r8' into staging/lineage-20.0_merge-android-13.0.0_r8

Android 13.0.0 Release 8 (TP1A.221005.003)

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCYzModwAKCRDorT+BmrEO
# eJ7IAJ9553GAy7zvLio/HB8EEwzv53k17ACfRLjUxZqDjvzlMkedHUvLAfQuHa4=
# =EyRG
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Sep 27 19:44:39 2022 EEST
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 1313 signatures in the past
#      11 months.  Encrypted 4 messages in the past 8 months.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Himanshu Rawat (1) and Tsung-Mao Fang (1)
# Via Android Build Coastguard Worker
* tag 'android-13.0.0_r8':
  Wi-Fi panel doesn't need to check permission
  Don't cancel passkey entry pairing autonomously

 Conflicts:
	res/values/config.xml

Change-Id: Id64603ba4b7696635b869c18c0c4fdbc0803d911
parents 0051f7a3 f38c5394
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -618,6 +618,12 @@
    <!-- Whether to put the apps with system UID into system component bucket or not -->
    <bool name="config_battery_combine_system_components">false</bool>

    <!-- An array of uid name for which packages exempt from Wi-Fi permission check. -->
    <string-array name="config_exempt_wifi_permission_uid_name" translatable="false">
        <item>@string/config_settingsintelligence_package_name</item>
        <item>android.uid.system:1000</item>
    </string-array>

    <!-- Whether the given language capitalizes nouns -->
    <bool name="language_capitalizes_nouns">false</bool>
</resources>
+6 −2
Original line number Diff line number Diff line
@@ -86,10 +86,14 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
    @Override
    public void onDestroy() {
        super.onDestroy();
        if (mPairingController.getDialogType()
                != BluetoothPairingController.DISPLAY_PASSKEY_DIALOG) {
            /* Cancel pairing unless explicitly accepted by user */
            if (!mPositiveClicked) {
                mPairingController.onCancel();
            }
        }
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+16 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ public class WifiSlice implements CustomSliceable {
    public Slice getSlice() {
        // If external calling package doesn't have Wi-Fi permission.
        final boolean isPermissionGranted =
                Utils.isSettingsIntelligence(mContext) || isPermissionGranted(mContext);
                isCallerExemptUid(mContext) || isPermissionGranted(mContext);
        final boolean isWifiEnabled = isWifiEnabled();
        ListBuilder listBuilder = getListBuilder(isWifiEnabled, null /* wifiSliceItem */,
                isPermissionGranted);
@@ -139,6 +139,21 @@ public class WifiSlice implements CustomSliceable {
        return listBuilder.build();
    }

    private boolean isCallerExemptUid(Context context) {
        final String[] allowedUidNames = context.getResources().getStringArray(
                R.array.config_exempt_wifi_permission_uid_name);
        final String uidName =
                context.getPackageManager().getNameForUid(Binder.getCallingUid());
        Log.d(TAG, "calling uid name : " + uidName);

        for (String allowedUidName : allowedUidNames) {
            if (TextUtils.equals(uidName, allowedUidName)) {
                return true;
            }
        }
        return false;
    }

    private static boolean isPermissionGranted(Context settingsContext) {
        final int callingUid = Binder.getCallingUid();
        final String callingPackage = settingsContext.getPackageManager()
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public class ContextualWifiSliceTest {
                mContext.getString(R.string.config_settingsintelligence_package_name);
        ShadowBinder.setCallingUid(1);
        when(mPackageManager.getPackagesForUid(1)).thenReturn(new String[]{siPackageName});
        when(mPackageManager.getNameForUid(1)).thenReturn(siPackageName);
        ShadowWifiSlice.setWifiPermissible(true);
        mWifiSlice = new ContextualWifiSlice(mContext);
    }
+4 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ public class WifiSliceTest {
        mSIPackageName = mContext.getString(R.string.config_settingsintelligence_package_name);
        ShadowBinder.setCallingUid(USER_ID);
        when(mPackageManager.getPackagesForUid(USER_ID)).thenReturn(new String[]{mSIPackageName});
        when(mPackageManager.getNameForUid(USER_ID)).thenReturn(mSIPackageName);
        ShadowWifiSlice.setWifiPermissible(true);
        mWifiSlice = new WifiSlice(mContext, mWifiRestriction);
    }
@@ -116,6 +117,7 @@ public class WifiSliceTest {
    @Test
    public void getWifiSlice_fromSIPackage_shouldHaveTitleAndToggle() {
        when(mPackageManager.getPackagesForUid(USER_ID)).thenReturn(new String[]{mSIPackageName});
        when(mPackageManager.getNameForUid(USER_ID)).thenReturn(mSIPackageName);
        ShadowWifiSlice.setWifiPermissible(false);

        final Slice wifiSlice = mWifiSlice.getSlice();
@@ -131,6 +133,7 @@ public class WifiSliceTest {
    @Test
    public void getWifiSlice_notFromSIPackageAndWithWifiPermission_shouldHaveTitleAndToggle() {
        when(mPackageManager.getPackagesForUid(USER_ID)).thenReturn(new String[]{"com.test"});
        when(mPackageManager.getNameForUid(USER_ID)).thenReturn("com.test");
        ShadowWifiSlice.setWifiPermissible(true);

        final Slice wifiSlice = mWifiSlice.getSlice();
@@ -145,6 +148,7 @@ public class WifiSliceTest {
    @Test
    public void getWifiSlice_notFromSIPackageAndWithoutWifiPermission_shouldReturnNoToggle() {
        when(mPackageManager.getPackagesForUid(USER_ID)).thenReturn(new String[]{"com.test"});
        when(mPackageManager.getNameForUid(USER_ID)).thenReturn("com.test");
        ShadowWifiSlice.setWifiPermissible(false);

        final Slice wifiSlice = mWifiSlice.getSlice();