diff options
author | erfanian <erfanian@google.com> | 2017-10-31 09:12:03 -0700 |
---|---|---|
committer | zachh <zachh@google.com> | 2017-11-01 21:25:54 +0000 |
commit | 1d1ac5b5a783e06ecda0adceda7df0af8a5566bc (patch) | |
tree | 050aa8efcbe53ac2c12a34d01725eb8c1778abef /java/com/android/dialer/assisteddialing/ConcreteCreator.java | |
parent | 04d4ba539eced0aae27050ec9f04a719239fd2a7 (diff) |
Disable assisted dialing when the phone is User Locked.
Because the phone is one of the few applications that operate
when the phone is locked, disable the feature to avoid reading/writing
any encrypted preferences while the user is in the locked state.
I do not anticipate this being a necessary feature when
the device is locked.
Bug: 65399148
Test: unit test
PiperOrigin-RevId: 174044403
Change-Id: I1b9a2ac677ced2af06455a384bf169c417ffc1a5
Diffstat (limited to 'java/com/android/dialer/assisteddialing/ConcreteCreator.java')
-rw-r--r-- | java/com/android/dialer/assisteddialing/ConcreteCreator.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/java/com/android/dialer/assisteddialing/ConcreteCreator.java b/java/com/android/dialer/assisteddialing/ConcreteCreator.java index 9dc197c89..9244f6934 100644 --- a/java/com/android/dialer/assisteddialing/ConcreteCreator.java +++ b/java/com/android/dialer/assisteddialing/ConcreteCreator.java @@ -22,6 +22,7 @@ import android.os.Build; import android.os.Build.VERSION_CODES; import android.preference.PreferenceManager; import android.support.annotation.NonNull; +import android.support.v4.os.UserManagerCompat; import android.telephony.TelephonyManager; import com.android.dialer.assisteddialing.ui.R; import com.android.dialer.common.LogUtil; @@ -65,6 +66,13 @@ public final class ConcreteCreator { throw new NullPointerException("Provided context was null"); } + if (!UserManagerCompat.isUserUnlocked(context)) { + // To avoid any issues reading preferences, we disable the feature when the user is in a + // locked state. + LogUtil.i("ConcreteCreator.createNewAssistedDialingMediator", "user is locked"); + return new AssistedDialingMediatorStub(); + } + if (!isAssistedDialingEnabled(configProvider)) { LogUtil.i("ConcreteCreator.createNewAssistedDialingMediator", "feature not enabled"); return new AssistedDialingMediatorStub(); |