Merge tag 'android-13.0.0_r61' into staging/lineage-20.0_merge-android-13.0.0_r61
Android 13.0.0 release 61
# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZKXIzgAKCRDorT+BmrEO
# eJ9sAJ9wprPCtUnY06JdjwW0rZOGwGRhyQCfVDIAyUWGSOeCLESUyjBFQLrkIww=
# =CFU6
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Jul 5 22:47:26 2023 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 1768 signatures in the past
# 20 months. Encrypted 4 messages in the past 18 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 Lin Yuan
# Via Android Build Coastguard Worker
* tag 'android-13.0.0_r61':
Fix: Bluetooth and Wifi scanning location MainSwitch page policy transparency.
Change-Id: I286f799bb82144646e224344e4b8c4b7f528dc82
diff --git a/src/com/android/settings/location/BluetoothScanningMainSwitchPreferenceController.java b/src/com/android/settings/location/BluetoothScanningMainSwitchPreferenceController.java
index b491ec9..78e3184 100644
--- a/src/com/android/settings/location/BluetoothScanningMainSwitchPreferenceController.java
+++ b/src/com/android/settings/location/BluetoothScanningMainSwitchPreferenceController.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.provider.Settings;
import android.widget.Switch;
+import android.os.UserManager;
import androidx.preference.PreferenceScreen;
@@ -33,9 +34,11 @@
implements OnMainSwitchChangeListener {
private static final String KEY_BLUETOOTH_SCANNING_SWITCH = "bluetooth_always_scanning_switch";
+ private final UserManager mUserManager;
public BluetoothScanningMainSwitchPreferenceController(Context context) {
super(context, KEY_BLUETOOTH_SCANNING_SWITCH);
+ mUserManager = UserManager.get(context);
}
@Override
@@ -49,7 +52,9 @@
@Override
public int getAvailabilityStatus() {
return mContext.getResources().getBoolean(R.bool.config_show_location_scanning)
- ? AVAILABLE
+ ? (mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_LOCATION)
+ ? DISABLED_DEPENDENT_SETTING
+ : AVAILABLE)
: UNSUPPORTED_ON_DEVICE;
}
diff --git a/src/com/android/settings/location/WifiScanningMainSwitchPreferenceController.java b/src/com/android/settings/location/WifiScanningMainSwitchPreferenceController.java
index 546f1e1..e22b0a0 100644
--- a/src/com/android/settings/location/WifiScanningMainSwitchPreferenceController.java
+++ b/src/com/android/settings/location/WifiScanningMainSwitchPreferenceController.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.net.wifi.WifiManager;
import android.widget.Switch;
+import android.os.UserManager;
import androidx.preference.PreferenceScreen;
@@ -34,10 +35,12 @@
private static final String KEY_WIFI_SCANNING_SWITCH = "wifi_always_scanning_switch";
private final WifiManager mWifiManager;
+ private final UserManager mUserManager;
public WifiScanningMainSwitchPreferenceController(Context context) {
super(context, KEY_WIFI_SCANNING_SWITCH);
mWifiManager = context.getSystemService(WifiManager.class);
+ mUserManager = UserManager.get(context);
}
@Override
@@ -52,7 +55,9 @@
@Override
public int getAvailabilityStatus() {
return mContext.getResources().getBoolean(R.bool.config_show_location_scanning)
- ? AVAILABLE
+ ? (mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_LOCATION)
+ ? DISABLED_DEPENDENT_SETTING
+ : AVAILABLE)
: UNSUPPORTED_ON_DEVICE;
}