Skip to content

Commit 2184a98

Browse files
Amith YamasaniAndroid (Google) Code Review
authored andcommitted
Merge "Lockscreen settings per user"
2 parents e4d8a5d + 52c489c commit 2184a98

File tree

9 files changed

+629
-117
lines changed

9 files changed

+629
-117
lines changed

Android.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ LOCAL_SRC_FILES += \
171171
core/java/com/android/internal/view/IInputMethodClient.aidl \
172172
core/java/com/android/internal/view/IInputMethodManager.aidl \
173173
core/java/com/android/internal/view/IInputMethodSession.aidl \
174+
core/java/com/android/internal/widget/ILockSettings.aidl \
174175
core/java/com/android/internal/widget/IRemoteViewsFactory.aidl \
175176
core/java/com/android/internal/widget/IRemoteViewsAdapterConnection.aidl \
176177
keystore/java/android/security/IKeyChainAliasCallback.aidl \

core/java/android/provider/Settings.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,19 @@
3636
import android.net.wifi.WifiManager;
3737
import android.os.BatteryManager;
3838
import android.os.Bundle;
39+
import android.os.IBinder;
3940
import android.os.RemoteException;
41+
import android.os.ServiceManager;
4042
import android.os.SystemProperties;
43+
import android.os.UserId;
4144
import android.speech.tts.TextToSpeech;
4245
import android.text.TextUtils;
4346
import android.util.AndroidException;
4447
import android.util.Log;
4548
import android.view.WindowOrientationListener;
4649

50+
import com.android.internal.widget.ILockSettings;
51+
4752
import java.net.URISyntaxException;
4853
import java.util.HashMap;
4954
import 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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (C) 2012 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.android.internal.widget;
18+
19+
/** {@hide} */
20+
interface ILockSettings {
21+
void setBoolean(in String key, in boolean value, in int userId);
22+
void setLong(in String key, in long value, in int userId);
23+
void setString(in String key, in String value, in int userId);
24+
boolean getBoolean(in String key, in boolean defaultValue, in int userId);
25+
long getLong(in String key, in long defaultValue, in int userId);
26+
String getString(in String key, in String defaultValue, in int userId);
27+
void setLockPattern(in byte[] hash, int userId);
28+
boolean checkPattern(in byte[] hash, int userId);
29+
void setLockPassword(in byte[] hash, int userId);
30+
boolean checkPassword(in byte[] hash, int userId);
31+
boolean havePattern(int userId);
32+
boolean havePassword(int userId);
33+
void removeUser(int userId);
34+
}

0 commit comments

Comments
 (0)