Loading core/java/android/provider/Settings.java +18 −32 Original line number Diff line number Diff line Loading @@ -99,7 +99,6 @@ import android.widget.Editor; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.Preconditions; import com.android.internal.widget.ILockSettings; import java.io.IOException; import java.lang.annotation.ElementType; Loading Loading @@ -6184,9 +6183,6 @@ public final class Settings { sProviderHolder, Secure.class); private static ILockSettings sLockSettings = null; private static boolean sIsSystemProcess; @UnsupportedAppUsage private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; @UnsupportedAppUsage Loading Loading @@ -6350,15 +6346,7 @@ public final class Settings { return Global.getStringForUser(resolver, name, userHandle); } if (MOVED_TO_LOCK_SETTINGS.contains(name)) { synchronized (Secure.class) { if (sLockSettings == null) { sLockSettings = ILockSettings.Stub.asInterface( (IBinder) ServiceManager.getService("lock_settings")); sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; } } if (sLockSettings != null && !sIsSystemProcess) { if (MOVED_TO_LOCK_SETTINGS.contains(name) && Process.myUid() != Process.SYSTEM_UID) { // No context; use the ActivityThread's context as an approximation for // determining the target API level. Application application = ActivityThread.currentApplication(); Loading @@ -6368,17 +6356,15 @@ public final class Settings { && application.getApplicationInfo().targetSdkVersion <= VERSION_CODES.LOLLIPOP_MR1; if (isPreMnc) { try { return sLockSettings.getString(name, "0", userHandle); } catch (RemoteException re) { // Fall through } } else { throw new SecurityException("Settings.Secure." + name + " is deprecated and no longer accessible." + " See API documentation for potential replacements."); } } // Old apps used to get the three deprecated LOCK_PATTERN_* settings from // ILockSettings.getString(). For security reasons, we now just return a // stubbed-out value. Note: the only one of these three settings actually known // to have been used was LOCK_PATTERN_ENABLED, and ILockSettings.getString() // already always returned "0" for that starting in Android 11. return "0"; } throw new SecurityException("Settings.Secure." + name + " is deprecated and no" + " longer accessible. See API documentation for potential replacements."); } return sNameValueCache.getStringForUser(resolver, name, userHandle); Loading services/core/java/com/android/server/locksettings/LockSettingsService.java +0 −14 Original line number Diff line number Diff line Loading @@ -1065,18 +1065,7 @@ public class LockSettingsService extends ILockSettings.Stub { mContext.enforceCallingOrSelfPermission(PERMISSION, "LockSettingsHave"); } private static final String[] UNPROTECTED_SETTINGS = { // These three LOCK_PATTERN_* settings have traditionally been readable via the public API // android.provider.Settings.{System,Secure}.getString() without any permission. Settings.Secure.LOCK_PATTERN_ENABLED, Settings.Secure.LOCK_PATTERN_VISIBLE, Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, }; private final void checkDatabaseReadPermission(String requestedKey, int userId) { if (ArrayUtils.contains(UNPROTECTED_SETTINGS, requestedKey)) { return; } if (!hasPermission(PERMISSION)) { throw new SecurityException("uid=" + getCallingUid() + " needs permission " + PERMISSION + " to read " + requestedKey + " for user " + userId); Loading Loading @@ -1190,9 +1179,6 @@ public class LockSettingsService extends ILockSettings.Stub { @Override public boolean getBoolean(String key, boolean defaultValue, int userId) { checkDatabaseReadPermission(key, userId); if (Settings.Secure.LOCK_PATTERN_ENABLED.equals(key)) { return getCredentialTypeInternal(userId) == CREDENTIAL_TYPE_PATTERN; } return mStorage.getBoolean(key, defaultValue, userId); } Loading Loading
core/java/android/provider/Settings.java +18 −32 Original line number Diff line number Diff line Loading @@ -99,7 +99,6 @@ import android.widget.Editor; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.Preconditions; import com.android.internal.widget.ILockSettings; import java.io.IOException; import java.lang.annotation.ElementType; Loading Loading @@ -6184,9 +6183,6 @@ public final class Settings { sProviderHolder, Secure.class); private static ILockSettings sLockSettings = null; private static boolean sIsSystemProcess; @UnsupportedAppUsage private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; @UnsupportedAppUsage Loading Loading @@ -6350,15 +6346,7 @@ public final class Settings { return Global.getStringForUser(resolver, name, userHandle); } if (MOVED_TO_LOCK_SETTINGS.contains(name)) { synchronized (Secure.class) { if (sLockSettings == null) { sLockSettings = ILockSettings.Stub.asInterface( (IBinder) ServiceManager.getService("lock_settings")); sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; } } if (sLockSettings != null && !sIsSystemProcess) { if (MOVED_TO_LOCK_SETTINGS.contains(name) && Process.myUid() != Process.SYSTEM_UID) { // No context; use the ActivityThread's context as an approximation for // determining the target API level. Application application = ActivityThread.currentApplication(); Loading @@ -6368,17 +6356,15 @@ public final class Settings { && application.getApplicationInfo().targetSdkVersion <= VERSION_CODES.LOLLIPOP_MR1; if (isPreMnc) { try { return sLockSettings.getString(name, "0", userHandle); } catch (RemoteException re) { // Fall through } } else { throw new SecurityException("Settings.Secure." + name + " is deprecated and no longer accessible." + " See API documentation for potential replacements."); } } // Old apps used to get the three deprecated LOCK_PATTERN_* settings from // ILockSettings.getString(). For security reasons, we now just return a // stubbed-out value. Note: the only one of these three settings actually known // to have been used was LOCK_PATTERN_ENABLED, and ILockSettings.getString() // already always returned "0" for that starting in Android 11. return "0"; } throw new SecurityException("Settings.Secure." + name + " is deprecated and no" + " longer accessible. See API documentation for potential replacements."); } return sNameValueCache.getStringForUser(resolver, name, userHandle); Loading
services/core/java/com/android/server/locksettings/LockSettingsService.java +0 −14 Original line number Diff line number Diff line Loading @@ -1065,18 +1065,7 @@ public class LockSettingsService extends ILockSettings.Stub { mContext.enforceCallingOrSelfPermission(PERMISSION, "LockSettingsHave"); } private static final String[] UNPROTECTED_SETTINGS = { // These three LOCK_PATTERN_* settings have traditionally been readable via the public API // android.provider.Settings.{System,Secure}.getString() without any permission. Settings.Secure.LOCK_PATTERN_ENABLED, Settings.Secure.LOCK_PATTERN_VISIBLE, Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, }; private final void checkDatabaseReadPermission(String requestedKey, int userId) { if (ArrayUtils.contains(UNPROTECTED_SETTINGS, requestedKey)) { return; } if (!hasPermission(PERMISSION)) { throw new SecurityException("uid=" + getCallingUid() + " needs permission " + PERMISSION + " to read " + requestedKey + " for user " + userId); Loading Loading @@ -1190,9 +1179,6 @@ public class LockSettingsService extends ILockSettings.Stub { @Override public boolean getBoolean(String key, boolean defaultValue, int userId) { checkDatabaseReadPermission(key, userId); if (Settings.Secure.LOCK_PATTERN_ENABLED.equals(key)) { return getCredentialTypeInternal(userId) == CREDENTIAL_TYPE_PATTERN; } return mStorage.getBoolean(key, defaultValue, userId); } Loading