3636import android .net .wifi .WifiManager ;
3737import android .os .BatteryManager ;
3838import android .os .Bundle ;
39+ import android .os .IBinder ;
3940import android .os .RemoteException ;
41+ import android .os .ServiceManager ;
4042import android .os .SystemProperties ;
43+ import android .os .UserId ;
4144import android .speech .tts .TextToSpeech ;
4245import android .text .TextUtils ;
4346import android .util .AndroidException ;
4447import android .util .Log ;
4548import android .view .WindowOrientationListener ;
4649
50+ import com .android .internal .widget .ILockSettings ;
51+
4752import java .net .URISyntaxException ;
4853import java .util .HashMap ;
4954import java .util .HashSet ;
@@ -2253,6 +2258,16 @@ public static final class Secure extends NameValueTable {
22532258 // Populated lazily, guarded by class object:
22542259 private static NameValueCache sNameValueCache = null ;
22552260
2261+ private static ILockSettings sLockSettings = null ;
2262+
2263+ private static final HashSet <String > MOVED_TO_LOCK_SETTINGS ;
2264+ static {
2265+ MOVED_TO_LOCK_SETTINGS = new HashSet <String >(3 );
2266+ MOVED_TO_LOCK_SETTINGS .add (Secure .LOCK_PATTERN_ENABLED );
2267+ MOVED_TO_LOCK_SETTINGS .add (Secure .LOCK_PATTERN_VISIBLE );
2268+ MOVED_TO_LOCK_SETTINGS .add (Secure .LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED );
2269+ }
2270+
22562271 /**
22572272 * Look up a name in the database.
22582273 * @param resolver to access the database with
@@ -2264,6 +2279,19 @@ public synchronized static String getString(ContentResolver resolver, String nam
22642279 sNameValueCache = new NameValueCache (SYS_PROP_SETTING_VERSION , CONTENT_URI ,
22652280 CALL_METHOD_GET_SECURE );
22662281 }
2282+
2283+ if (sLockSettings == null ) {
2284+ sLockSettings = ILockSettings .Stub .asInterface (
2285+ (IBinder ) ServiceManager .getService ("lock_settings" ));
2286+ }
2287+ if (sLockSettings != null && MOVED_TO_LOCK_SETTINGS .contains (name )) {
2288+ try {
2289+ return sLockSettings .getString (name , "0" , UserId .getCallingUserId ());
2290+ } catch (RemoteException re ) {
2291+ // Fall through
2292+ }
2293+ }
2294+
22672295 return sNameValueCache .getString (resolver , name );
22682296 }
22692297
0 commit comments