Merge "Allow trust agents to actively unlock for automotive." into qt-dev
am: 0f347bbc3c
Change-Id: If6fbede6a865470e138b0023392653ec0e437b8a
This commit is contained in:
@@ -199,6 +199,7 @@ public class TrustManagerService extends SystemService {
|
|||||||
private final Uri LOCK_SCREEN_WHEN_TRUST_LOST =
|
private final Uri LOCK_SCREEN_WHEN_TRUST_LOST =
|
||||||
Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST);
|
Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST);
|
||||||
|
|
||||||
|
private final boolean mIsAutomotive;
|
||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
private boolean mTrustAgentsExtendUnlock;
|
private boolean mTrustAgentsExtendUnlock;
|
||||||
private boolean mLockWhenTrustLost;
|
private boolean mLockWhenTrustLost;
|
||||||
@@ -210,6 +211,10 @@ public class TrustManagerService extends SystemService {
|
|||||||
*/
|
*/
|
||||||
SettingsObserver(Handler handler) {
|
SettingsObserver(Handler handler) {
|
||||||
super(handler);
|
super(handler);
|
||||||
|
|
||||||
|
PackageManager packageManager = getContext().getPackageManager();
|
||||||
|
mIsAutomotive = packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
|
||||||
|
|
||||||
mContentResolver = getContext().getContentResolver();
|
mContentResolver = getContext().getContentResolver();
|
||||||
updateContentObserver();
|
updateContentObserver();
|
||||||
}
|
}
|
||||||
@@ -233,11 +238,15 @@ public class TrustManagerService extends SystemService {
|
|||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange, Uri uri) {
|
public void onChange(boolean selfChange, Uri uri) {
|
||||||
if (TRUST_AGENTS_EXTEND_UNLOCK.equals(uri)) {
|
if (TRUST_AGENTS_EXTEND_UNLOCK.equals(uri)) {
|
||||||
|
// Smart lock should only extend unlock. The only exception is for automotive,
|
||||||
|
// where it can actively unlock the head unit.
|
||||||
|
int defaultValue = mIsAutomotive ? 0 : 1;
|
||||||
|
|
||||||
mTrustAgentsExtendUnlock =
|
mTrustAgentsExtendUnlock =
|
||||||
Settings.Secure.getIntForUser(
|
Settings.Secure.getIntForUser(
|
||||||
mContentResolver,
|
mContentResolver,
|
||||||
Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK,
|
Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK,
|
||||||
1 /* default */,
|
defaultValue,
|
||||||
mCurrentUser) != 0;
|
mCurrentUser) != 0;
|
||||||
} else if (LOCK_SCREEN_WHEN_TRUST_LOST.equals(uri)) {
|
} else if (LOCK_SCREEN_WHEN_TRUST_LOST.equals(uri)) {
|
||||||
mLockWhenTrustLost =
|
mLockWhenTrustLost =
|
||||||
|
|||||||
Reference in New Issue
Block a user