diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-11-01 23:24:30 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-11-01 23:24:30 +0000 |
commit | 53474a1dca5d1c80571d03cd929a91217a14d1fa (patch) | |
tree | 050aa8efcbe53ac2c12a34d01725eb8c1778abef /java | |
parent | 09667cbdf87df772181f658982ae9b8ea5d0ac5d (diff) | |
parent | 1d1ac5b5a783e06ecda0adceda7df0af8a5566bc (diff) |
Merge "Disable assisted dialing when the phone is User Locked."
Diffstat (limited to '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(); |