diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-06-06 04:08:21 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-06-06 04:08:21 +0000 |
commit | 6b41e3a0c6024b4afb7cef10973d95d6d0daf294 (patch) | |
tree | b3c49f529f9cdcb8a45c58bbed51d0c3fe0bfd64 /java | |
parent | 87300f1c76e30f6086f7fd1f44ddd7faaed2e1a7 (diff) | |
parent | 26cb60dd6e2a9eb748282a4dbf8352904a5c3310 (diff) |
Merge changes If238bad0,I81d19e22
* changes:
Center favorites name text
Allow CallingAccountSelector to be shown when the device is locked.
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/precall/impl/PreCallActivity.java | 31 | ||||
-rw-r--r-- | java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml | 2 |
2 files changed, 28 insertions, 5 deletions
diff --git a/java/com/android/dialer/precall/impl/PreCallActivity.java b/java/com/android/dialer/precall/impl/PreCallActivity.java index ee417b968..7b27945e5 100644 --- a/java/com/android/dialer/precall/impl/PreCallActivity.java +++ b/java/com/android/dialer/precall/impl/PreCallActivity.java @@ -16,11 +16,8 @@ package com.android.dialer.precall.impl; -import android.annotation.TargetApi; import android.app.Activity; import android.app.KeyguardManager; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.WindowManager.LayoutParams; @@ -36,8 +33,32 @@ public class PreCallActivity extends Activity { preCallCoordinator = new PreCallCoordinatorImpl(this); preCallCoordinator.onCreate(getIntent(), savedInstanceState); if (getSystemService(KeyguardManager.class).isKeyguardLocked()) { - getWindow().addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED); - + // Note: + // + // Flag LayoutParams.FLAG_TURN_SCREEN_ON was deprecated in O_MR1, but calling the new API + // setTurnScreenOn(true) doesn't give us the expected behavior. + // + // Calling setTurnScreenOn(true) alone doesn't turn on the screen when the device is locked. + // We must also call KeyguardManager#requestDismissKeyguard, which will bring up the lock + // screen for the user to enter their credentials. + // + // If the Keyguard is not secure or the device is currently in a trusted state, calling + // requestDismissKeyguard will immediately dismiss the Keyguard without any user interaction. + // However, the lock screen will still pop up before it quickly disappears. + // + // If the Keyguard is secure and the device is not in a trusted state, the device will show + // the lock screen and wait for the user's credentials. + // + // Therefore, to avoid showing the lock screen, we will continue using the deprecated flag in + // O_MR1 and later Android versions. + // + // Flag LayoutParams.FLAG_SHOW_WHEN_LOCKED was also deprecated in O_MR1, and the new API + // setShowWhenLocked(boolean) works. However, as the purpose of the two new APIs is to prevent + // an unintentional double life-cycle event, only using one is ineffective. + // + // Therefore, to simplify code and make testing easier, we will also keep using + // LayoutParams.FLAG_SHOW_WHEN_LOCKED. + getWindow().addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED | LayoutParams.FLAG_TURN_SCREEN_ON); } } diff --git a/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml b/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml index a8bc55bb7..1299f08c7 100644 --- a/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml +++ b/java/com/android/dialer/speeddial/res/layout/favorite_item_layout.xml @@ -68,6 +68,7 @@ android:layout_marginBottom="1dp" android:fontFamily="sans-serif-medium" android:textSize="14sp" + android:gravity="center_horizontal" style="@style/Dialer.TextAppearance.Primary"/> <TextView @@ -78,5 +79,6 @@ android:layout_marginStart="4dp" android:layout_marginEnd="4dp" android:layout_marginBottom="17dp" + android:gravity="center_horizontal" style="@style/Dialer.TextAppearance.Secondary"/> </LinearLayout>
\ No newline at end of file |