Merge changes from topic "catalyst" into main
* changes: [Catalyst] Specify read/write permissions for "Mobile data" [Catalyst] Update permission check API signature
This commit is contained in:
committed by
Android (Google) Code Review
commit
4bfd857a7e
@@ -35,11 +35,15 @@ class AdaptiveConnectivityTogglePreference :
|
||||
override fun storage(context: Context): KeyValueStore =
|
||||
AdaptiveConnectivityToggleStorage(context, SettingsSecureStore.get(context))
|
||||
|
||||
override fun getReadPermit(context: Context, myUid: Int, callingUid: Int) =
|
||||
override fun getReadPermit(context: Context, callingPid: Int, callingUid: Int) =
|
||||
ReadWritePermit.ALLOW
|
||||
|
||||
override fun getWritePermit(context: Context, value: Boolean?, myUid: Int, callingUid: Int) =
|
||||
ReadWritePermit.ALLOW
|
||||
override fun getWritePermit(
|
||||
context: Context,
|
||||
value: Boolean?,
|
||||
callingPid: Int,
|
||||
callingUid: Int,
|
||||
) = ReadWritePermit.ALLOW
|
||||
|
||||
override val sensitivityLevel
|
||||
get() = SensitivityLevel.NO_SENSITIVITY
|
||||
|
||||
@@ -65,10 +65,15 @@ class AirplaneModePreference :
|
||||
override val restrictionKeys
|
||||
get() = arrayOf(UserManager.DISALLOW_AIRPLANE_MODE)
|
||||
|
||||
override fun getReadPermit(context: Context, myUid: Int, callingUid: Int) =
|
||||
override fun getReadPermit(context: Context, callingPid: Int, callingUid: Int) =
|
||||
ReadWritePermit.ALLOW
|
||||
|
||||
override fun getWritePermit(context: Context, value: Boolean?, myUid: Int, callingUid: Int) =
|
||||
override fun getWritePermit(
|
||||
context: Context,
|
||||
value: Boolean?,
|
||||
callingPid: Int,
|
||||
callingUid: Int,
|
||||
) =
|
||||
when {
|
||||
isSatelliteOn(context) || isInEcmMode(context) -> ReadWritePermit.DISALLOW
|
||||
else -> ReadWritePermit.ALLOW
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.network
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.telephony.SubscriptionManager
|
||||
import com.android.settings.R
|
||||
@@ -45,11 +46,30 @@ class MobileDataPreference :
|
||||
|
||||
override fun storage(context: Context): KeyValueStore = MobileDataStorage(context)
|
||||
|
||||
override fun getReadPermit(context: Context, myUid: Int, callingUid: Int) =
|
||||
override fun getReadPermissions(context: Context) =
|
||||
arrayOf(
|
||||
// required by TelephonyManager.isDataEnabledForReason
|
||||
Manifest.permission.ACCESS_NETWORK_STATE,
|
||||
Manifest.permission.READ_PHONE_STATE,
|
||||
Manifest.permission.MODIFY_PHONE_STATE,
|
||||
Manifest.permission.READ_BASIC_PHONE_STATE,
|
||||
)
|
||||
|
||||
override fun getWritePermissions(context: Context) =
|
||||
arrayOf(
|
||||
// required by TelephonyManager.setDataEnabledForReason
|
||||
Manifest.permission.MODIFY_PHONE_STATE
|
||||
)
|
||||
|
||||
override fun getReadPermit(context: Context, callingPid: Int, callingUid: Int) =
|
||||
ReadWritePermit.ALLOW
|
||||
|
||||
override fun getWritePermit(context: Context, value: Boolean?, myUid: Int, callingUid: Int) =
|
||||
ReadWritePermit.ALLOW
|
||||
override fun getWritePermit(
|
||||
context: Context,
|
||||
value: Boolean?,
|
||||
callingPid: Int,
|
||||
callingUid: Int,
|
||||
) = ReadWritePermit.ALLOW
|
||||
|
||||
override val sensitivityLevel
|
||||
get() = SensitivityLevel.LOW_SENSITIVITY
|
||||
|
||||
@@ -77,11 +77,15 @@ class BluetoothTetherSwitchPreference :
|
||||
return !dataSaverBackend.isDataSaverEnabled
|
||||
}
|
||||
|
||||
override fun getReadPermit(context: Context, myUid: Int, callingUid: Int) =
|
||||
override fun getReadPermit(context: Context, callingPid: Int, callingUid: Int) =
|
||||
ReadWritePermit.ALLOW
|
||||
|
||||
override fun getWritePermit(context: Context, value: Boolean?, myUid: Int, callingUid: Int) =
|
||||
ReadWritePermit.ALLOW
|
||||
override fun getWritePermit(
|
||||
context: Context,
|
||||
value: Boolean?,
|
||||
callingPid: Int,
|
||||
callingUid: Int,
|
||||
) = ReadWritePermit.ALLOW
|
||||
|
||||
override val sensitivityLevel: Int
|
||||
get() = SensitivityLevel.LOW_SENSITIVITY
|
||||
|
||||
Reference in New Issue
Block a user