diff options
-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(); |