From 89f71f314e452a254c5ccc44a026facb3f1254b0 Mon Sep 17 00:00:00 2001 From: shagbag913 Date: Sun, 22 Dec 2019 05:53:41 -0500 Subject: [PATCH 1/5] KeyguardSliceView: adjust placement when Type clock is in use Change-Id: I401e3c666d905b79047ac20edae283bd91021ff5 --- packages/SystemUI/res-keyguard/values/dimens.xml | 3 +++ .../com/android/keyguard/KeyguardClockSwitch.java | 13 ++++++++++++- .../src/com/android/keyguard/KeyguardSliceView.java | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index f9389ce24d96..9bad1654573f 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -81,4 +81,7 @@ -32dp + + + 32dp diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index 3af445e9a2ae..368b1fdcf30f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -18,6 +18,7 @@ import android.util.AttributeSet; import android.util.Log; import android.util.MathUtils; +import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -29,6 +30,7 @@ import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.colorextraction.ColorExtractor.OnColorsChangedListener; import com.android.keyguard.clock.ClockManager; +import com.android.keyguard.KeyguardSliceView; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.colorextraction.SysuiColorExtractor; @@ -111,7 +113,7 @@ public class KeyguardClockSwitch extends RelativeLayout { * Status area (date and other stuff) shown below the clock. Plugin can decide whether or not to * show it below the alternate clock. */ - private View mKeyguardStatusArea; + private KeyguardSliceView mKeyguardStatusArea; /** * Maintain state so that a newly connected plugin can be initialized. @@ -238,6 +240,7 @@ private void setClockPlugin(ClockPlugin plugin) { mClockPlugin.onDestroyView(); mClockPlugin = null; } + adjustStatusAreaPadding(plugin); if (plugin == null) { if (mShowingHeader) { mClockView.setVisibility(View.GONE); @@ -470,6 +473,14 @@ private void updateBigClockAlpha() { } } + private void adjustStatusAreaPadding(ClockPlugin plugin) { + final boolean mIsTypeClock = plugin != null && plugin.getName().equals("type"); + mKeyguardStatusArea.setRowGravity(mIsTypeClock ? Gravity.LEFT : Gravity.CENTER); + mKeyguardStatusArea.setRowPadding(mIsTypeClock ? mContext.getResources() + .getDimensionPixelSize(R.dimen.keyguard_status_area_typeclock_padding) : 0, 0, 0, + 0); + } + /** * Sets if the keyguard slice is showing a center-aligned header. We need a smaller clock in * these cases. diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java index d35b8ba0d4f0..650cdf7745c2 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java @@ -192,6 +192,14 @@ public void onVisibilityAggregated(boolean isVisible) { setLayoutTransition(isVisible ? mLayoutTransition : null); } + public void setRowGravity(int gravity) { + mRow.setGravity(gravity); + } + + public void setRowPadding(int left, int top, int right, int bottom) { + mRow.setPadding(left, top, right, bottom); + } + /** * Returns whether the current visible slice has a title/header. */ From e396bfd43258c6bea6b0cc675126141a544802a6 Mon Sep 17 00:00:00 2001 From: Lucchetto Date: Sat, 14 Nov 2020 18:36:17 +0100 Subject: [PATCH 2/5] Revert "TelephonyManager: make duplicated baseband string hax configurable" This reverts commit 8cea738bb98e36a9f631d4e1effcf71004506e6a. Signed-off-by: Lucchetto --- core/res/res-revengeos/values/config.xml | 3 --- core/res/res-revengeos/values/symbols.xml | 2 -- telephony/java/android/telephony/TelephonyManager.java | 8 ++------ 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/core/res/res-revengeos/values/config.xml b/core/res/res-revengeos/values/config.xml index 9f307c43ee5e..ede3e94fa06d 100644 --- a/core/res/res-revengeos/values/config.xml +++ b/core/res/res-revengeos/values/config.xml @@ -125,9 +125,6 @@ true - - false - diff --git a/core/res/res-revengeos/values/symbols.xml b/core/res/res-revengeos/values/symbols.xml index 6251abf9f8f0..7acdc2d7d92f 100644 --- a/core/res/res-revengeos/values/symbols.xml +++ b/core/res/res-revengeos/values/symbols.xml @@ -53,8 +53,6 @@ - - diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 3f59cc6f1de3..fbd5317e69ed 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -10103,12 +10103,8 @@ public void setBasebandVersion(String version) { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public void setBasebandVersionForPhone(int phoneId, String version) { if (SubscriptionManager.isValidPhoneId(phoneId)) { - List newList = updateTelephonyProperty( - TelephonyProperties.baseband_version(), phoneId, version); - if (mContext.getResources().getBoolean( - com.android.internal.R.bool.config_trim_baseband_version_string)) { - newList = Arrays.asList(newList.get(0)); - } + List newList = Arrays.asList(updateTelephonyProperty( + TelephonyProperties.baseband_version(), phoneId, version).get(0)); TelephonyProperties.baseband_version(newList); } } From 8d8b5b841cfbaf69819ade9edaa19911a21e5d88 Mon Sep 17 00:00:00 2001 From: Lucchetto Date: Sat, 14 Nov 2020 18:36:41 +0100 Subject: [PATCH 3/5] Revert "[DNM]: fix duplicated baseband version string" This reverts commit 8b918fe09852127293283f894a138c7f388a0c94. Signed-off-by: Lucchetto --- telephony/java/android/telephony/TelephonyManager.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index fbd5317e69ed..8ae1ee99b060 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -117,7 +117,6 @@ import java.io.IOException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -10103,8 +10102,8 @@ public void setBasebandVersion(String version) { @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public void setBasebandVersionForPhone(int phoneId, String version) { if (SubscriptionManager.isValidPhoneId(phoneId)) { - List newList = Arrays.asList(updateTelephonyProperty( - TelephonyProperties.baseband_version(), phoneId, version).get(0)); + List newList = updateTelephonyProperty( + TelephonyProperties.baseband_version(), phoneId, version); TelephonyProperties.baseband_version(newList); } } From b92390c1e135edb29d93564db53dbe84c7faec1e Mon Sep 17 00:00:00 2001 From: Ido Ben-Hur Date: Mon, 12 Oct 2020 19:58:54 +0300 Subject: [PATCH 4/5] SystemUI: Nuke bubble clock First of all it's very ugly, secondly it does not work. AOSP decided to use it for their test module for some reason, so we made it use the analog clock controller instead. Change-Id: Ie2271911f34937f8c24f17929a3858ea8dce6033 --- .../keyguard/clock/AnalogClockController.java | 2 +- .../keyguard/clock/BubbleClockController.java | 190 ------------------ .../android/keyguard/clock/ClockManager.java | 1 - .../clock/BubbleClockControllerTest.java | 75 ------- .../keyguard/clock/ClockManagerTest.java | 64 +++--- 5 files changed, 33 insertions(+), 299 deletions(-) delete mode 100644 packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java delete mode 100644 packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java diff --git a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java index 3cb17126780c..acbf754863fe 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/AnalogClockController.java @@ -70,7 +70,7 @@ public class AnalogClockController implements ClockPlugin { private final ClockPalette mPalette = new ClockPalette(); /** - * Create a BubbleClockController instance. + * Create a AnalogClockController instance. * * @param res Resources contains title and thumbnail. * @param inflater Inflater used to inflate custom clock views. diff --git a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java b/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java deleted file mode 100644 index 8a9c410f7802..000000000000 --- a/packages/SystemUI/src/com/android/keyguard/clock/BubbleClockController.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.keyguard.clock; - -import android.app.WallpaperManager; -import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Color; -import android.graphics.Paint.Style; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.TextClock; - -import com.android.internal.colorextraction.ColorExtractor; -import com.android.systemui.R; -import com.android.systemui.colorextraction.SysuiColorExtractor; -import com.android.systemui.plugins.ClockPlugin; - -import java.util.TimeZone; - -/** - * Controller for Bubble clock that can appear on lock screen and AOD. - */ -public class BubbleClockController implements ClockPlugin { - - /** - * Resources used to get title and thumbnail. - */ - private final Resources mResources; - - /** - * LayoutInflater used to inflate custom clock views. - */ - private final LayoutInflater mLayoutInflater; - - /** - * Extracts accent color from wallpaper. - */ - private final SysuiColorExtractor mColorExtractor; - - /** - * Renders preview from clock view. - */ - private final ViewPreviewer mRenderer = new ViewPreviewer(); - - /** - * Custom clock shown on AOD screen and behind stack scroller on lock. - */ - private ClockLayout mView; - private ImageClock mAnalogClock; - - /** - * Helper to extract colors from wallpaper palette for clock face. - */ - private final ClockPalette mPalette = new ClockPalette(); - - /** - * Create a BubbleClockController instance. - * - * @param res Resources contains title and thumbnail. - * @param inflater Inflater used to inflate custom clock views. - * @param colorExtractor Extracts accent color from wallpaper. - */ - public BubbleClockController(Resources res, LayoutInflater inflater, - SysuiColorExtractor colorExtractor) { - mResources = res; - mLayoutInflater = inflater; - mColorExtractor = colorExtractor; - } - - private void createViews() { - mView = (ClockLayout) mLayoutInflater.inflate(R.layout.bubble_clock, null); - mAnalogClock = (ImageClock) mView.findViewById(R.id.analog_clock); - } - - @Override - public void onDestroyView() { - mView = null; - mAnalogClock = null; - } - - @Override - public String getName() { - return "bubble"; - } - - @Override - public String getTitle() { - return mResources.getString(R.string.clock_title_bubble); - } - - @Override - public Bitmap getThumbnail() { - return BitmapFactory.decodeResource(mResources, R.drawable.bubble_thumbnail); - } - - @Override - public Bitmap getPreview(int width, int height) { - - // Use the big clock view for the preview - View view = getBigClockView(); - - // Initialize state of plugin before generating preview. - setDarkAmount(1f); - setTextColor(Color.WHITE); - ColorExtractor.GradientColors colors = mColorExtractor.getColors( - WallpaperManager.FLAG_LOCK); - setColorPalette(colors.supportsDarkText(), colors.getColorPalette()); - onTimeTick(); - - return mRenderer.createPreview(view, width, height); - } - - @Override - public View getView() { - return null; - } - - @Override - public View getBigClockView() { - if (mView == null) { - createViews(); - } - return mView; - } - - @Override - public int getPreferredY(int totalHeight) { - return totalHeight / 2; - } - - @Override - public void setTextColor(int color) { - updateColor(); - } - - @Override - public void setColorPalette(boolean supportsDarkText, int[] colorPalette) { - mPalette.setColorPalette(supportsDarkText, colorPalette); - updateColor(); - } - - private void updateColor() { - final int primary = mPalette.getPrimaryColor(); - final int secondary = mPalette.getSecondaryColor(); - mAnalogClock.setClockColors(primary, secondary); - } - - @Override - public void setDarkAmount(float darkAmount) { - mPalette.setDarkAmount(darkAmount); - mView.setDarkAmount(darkAmount); - } - - @Override - public void onTimeTick() { - mAnalogClock.onTimeChanged(); - mView.onTimeChanged(); - } - - @Override - public void onTimeZoneChanged(TimeZone timeZone) { - mAnalogClock.onTimeZoneChanged(timeZone); - } - - @Override - public boolean shouldShowStatusArea() { - return true; - } - - @Override - public boolean shouldShowInBigContainer() { - return true; - } -} diff --git a/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java b/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java index c18708b247e2..e6dbae6b51a8 100644 --- a/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java +++ b/packages/SystemUI/src/com/android/keyguard/clock/ClockManager.java @@ -150,7 +150,6 @@ public ClockManager(Context context, InjectionInflationController injectionInfla LayoutInflater layoutInflater = injectionInflater.injectable(LayoutInflater.from(context)); addBuiltinClock(() -> new DefaultClockController(res, layoutInflater, colorExtractor)); - addBuiltinClock(() -> new BubbleClockController(res, layoutInflater, colorExtractor)); addBuiltinClock(() -> new AnalogClockController(res, layoutInflater, colorExtractor)); addBuiltinClock(() -> new TypeClockController(res, layoutInflater, colorExtractor)); addBuiltinClock(() -> new BinaryClockController(res, layoutInflater, colorExtractor)); diff --git a/packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java deleted file mode 100644 index b56986eb80d0..000000000000 --- a/packages/SystemUI/tests/src/com/android/keyguard/clock/BubbleClockControllerTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.keyguard.clock; - -import static com.google.common.truth.Truth.assertThat; - -import android.content.res.Resources; -import android.graphics.Color; -import android.test.suitebuilder.annotation.SmallTest; -import android.testing.AndroidTestingRunner; -import android.testing.TestableLooper.RunWithLooper; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.android.systemui.SysuiTestCase; -import com.android.systemui.colorextraction.SysuiColorExtractor; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -@SmallTest -@RunWith(AndroidTestingRunner.class) -@RunWithLooper -public final class BubbleClockControllerTest extends SysuiTestCase { - - private BubbleClockController mClockController; - @Mock SysuiColorExtractor mMockColorExtractor; - - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); - - Resources res = getContext().getResources(); - LayoutInflater layoutInflater = LayoutInflater.from(getContext()); - mClockController = new BubbleClockController(res, layoutInflater, mMockColorExtractor); - } - - @Test - public void setDarkAmount_AOD() { - ViewGroup smallClockFrame = (ViewGroup) mClockController.getView(); - View smallClock = smallClockFrame.getChildAt(0); - // WHEN dark amount is set to AOD - mClockController.setDarkAmount(1f); - // THEN small clock should not be shown. - assertThat(smallClock.getVisibility()).isEqualTo(View.VISIBLE); - } - - @Test - public void setColorPalette_setDigitalClock() { - ViewGroup smallClock = (ViewGroup) mClockController.getView(); - // WHEN text color is set - mClockController.setColorPalette(true, new int[]{Color.RED}); - // THEN child of small clock should have text color set. - TextView digitalClock = (TextView) smallClock.getChildAt(0); - assertThat(digitalClock.getCurrentTextColor()).isEqualTo(Color.RED); - } -} diff --git a/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java index 353fe625b8ea..a2c0b484549f 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/clock/ClockManagerTest.java @@ -59,8 +59,8 @@ @RunWithLooper(setAsMainLooper = true) public final class ClockManagerTest extends SysuiTestCase { - private static final String BUBBLE_CLOCK = BubbleClockController.class.getName(); - private static final Class BUBBLE_CLOCK_CLASS = BubbleClockController.class; + private static final String ANALOG_CLOCK = AnalogClockController.class.getName(); + private static final Class ANALOG_CLOCK_CLASS = AnalogClockController.class; private static final int MAIN_USER_ID = 0; private static final int SECONDARY_USER_ID = 11; private static final Uri SETTINGS_URI = null; @@ -95,7 +95,7 @@ public void setUp() { mMockPluginManager, mMockColorExtractor, mMockContentResolver, mMockCurrentUserObserable, mMockSettingsWrapper, mFakeDockManager); - mClockManager.addBuiltinClock(() -> new BubbleClockController( + mClockManager.addBuiltinClock(() -> new AnalogClockController( getContext().getResources(), inflater, mMockColorExtractor)); mClockManager.addOnClockChangedListener(mMockListener1); mClockManager.addOnClockChangedListener(mMockListener2); @@ -135,39 +135,39 @@ public void getCurrentClock_default() { @Test public void getCurrentClock_customClock() { - // GIVEN that settings is set to the bubble clock face - when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); + // GIVEN that settings is set to the analog clock face + when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(ANALOG_CLOCK); // WHEN settings change event is fired mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); - // THEN the plugin is the bubble clock face. - assertThat(mClockManager.getCurrentClock()).isInstanceOf(BUBBLE_CLOCK_CLASS); + // THEN the plugin is the analog clock face. + assertThat(mClockManager.getCurrentClock()).isInstanceOf(ANALOG_CLOCK_CLASS); } @Test public void onClockChanged_customClock() { - // GIVEN that settings is set to the bubble clock face - when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); + // GIVEN that settings is set to the analog clock face + when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(ANALOG_CLOCK); // WHEN settings change event is fired mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); - // THEN the plugin is the bubble clock face. + // THEN the plugin is the analog clock face. ArgumentCaptor captor = ArgumentCaptor.forClass(ClockPlugin.class); verify(mMockListener1).onClockChanged(captor.capture()); - assertThat(captor.getValue()).isInstanceOf(BUBBLE_CLOCK_CLASS); + assertThat(captor.getValue()).isInstanceOf(ANALOG_CLOCK_CLASS); } @Test public void onClockChanged_uniqueInstances() { - // GIVEN that settings is set to the bubble clock face - when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); + // GIVEN that settings is set to the analog clock face + when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(ANALOG_CLOCK); // WHEN settings change event is fired mContentObserver.onChange(false, Arrays.asList(SETTINGS_URI), 0, MAIN_USER_ID); - // THEN the listeners receive separate instances of the Bubble clock plugin. + // THEN the listeners receive separate instances of the analog clock plugin. ArgumentCaptor captor1 = ArgumentCaptor.forClass(ClockPlugin.class); ArgumentCaptor captor2 = ArgumentCaptor.forClass(ClockPlugin.class); verify(mMockListener1).onClockChanged(captor1.capture()); verify(mMockListener2).onClockChanged(captor2.capture()); - assertThat(captor1.getValue()).isInstanceOf(BUBBLE_CLOCK_CLASS); - assertThat(captor2.getValue()).isInstanceOf(BUBBLE_CLOCK_CLASS); + assertThat(captor1.getValue()).isInstanceOf(ANALOG_CLOCK_CLASS); + assertThat(captor2.getValue()).isInstanceOf(ANALOG_CLOCK_CLASS); assertThat(captor1.getValue()).isNotSameAs(captor2.getValue()); } @@ -192,12 +192,12 @@ public void getCurrentClock_dockedDefault() { @Test public void getCurrentClock_dockedCustomClock() { - // GIVEN settings is set to the bubble clock face - when(mMockSettingsWrapper.getDockedClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); + // GIVEN settings is set to the analog clock face + when(mMockSettingsWrapper.getDockedClockFace(anyInt())).thenReturn(ANALOG_CLOCK); // WHEN dock event fires mFakeDockManager.setDockEvent(DockManager.STATE_DOCKED); - // THEN the plugin is the bubble clock face. - assertThat(mClockManager.getCurrentClock()).isInstanceOf(BUBBLE_CLOCK_CLASS); + // THEN the plugin is the analog clock face. + assertThat(mClockManager.getCurrentClock()).isInstanceOf(ANALOG_CLOCK_CLASS); } @Test @@ -213,13 +213,13 @@ public void getCurrentClock_badDockedSettingsValue() { @Test public void getCurrentClock_badDockedSettingsFallback() { // GIVEN settings contains a value that doesn't correspond to an available clock face, but - // locked screen settings is set to bubble clock. + // locked screen settings is set to analog clock. when(mMockSettingsWrapper.getDockedClockFace(anyInt())).thenReturn("bad value"); - when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(BUBBLE_CLOCK); + when(mMockSettingsWrapper.getLockScreenCustomClockFace(anyInt())).thenReturn(ANALOG_CLOCK); // WHEN dock event is fired mFakeDockManager.setDockEvent(DockManager.STATE_DOCKED); - // THEN the plugin is the bubble clock face. - assertThat(mClockManager.getCurrentClock()).isInstanceOf(BUBBLE_CLOCK_CLASS); + // THEN the plugin is the analog clock face. + assertThat(mClockManager.getCurrentClock()).isInstanceOf(ANALOG_CLOCK_CLASS); } @Test @@ -232,24 +232,24 @@ public void onUserChanged_defaultClock() { @Test public void onUserChanged_customClock() { - // GIVEN that a second user has selected the bubble clock face + // GIVEN that a second user has selected the analog clock face when(mMockSettingsWrapper.getLockScreenCustomClockFace(SECONDARY_USER_ID)).thenReturn( - BUBBLE_CLOCK); + ANALOG_CLOCK); // WHEN the user changes mCurrentUser.setValue(SECONDARY_USER_ID); - // THEN the plugin is the bubble clock face. - assertThat(mClockManager.getCurrentClock()).isInstanceOf(BUBBLE_CLOCK_CLASS); + // THEN the plugin is the analog clock face. + assertThat(mClockManager.getCurrentClock()).isInstanceOf(ANALOG_CLOCK_CLASS); } @Test public void onUserChanged_docked() { // GIVEN device is docked mFakeDockManager.setDockEvent(DockManager.STATE_DOCKED); - // AND the second user as selected the bubble clock for the dock - when(mMockSettingsWrapper.getDockedClockFace(SECONDARY_USER_ID)).thenReturn(BUBBLE_CLOCK); + // AND the second user as selected the analog clock for the dock + when(mMockSettingsWrapper.getDockedClockFace(SECONDARY_USER_ID)).thenReturn(ANALOG_CLOCK); // WHEN the user changes mCurrentUser.setValue(SECONDARY_USER_ID); - // THEN the plugin is the bubble clock face. - assertThat(mClockManager.getCurrentClock()).isInstanceOf(BUBBLE_CLOCK_CLASS); + // THEN the plugin is the analog clock face. + assertThat(mClockManager.getCurrentClock()).isInstanceOf(ANALOG_CLOCK_CLASS); } } From 258004e1e498658f31ca80f45af46b4ff0675239 Mon Sep 17 00:00:00 2001 From: maxwen Date: Sun, 18 Oct 2020 17:33:26 +0200 Subject: [PATCH 5/5] SystemUI: use DOUBLE_TAP_TO_WAKE setting also for wake from aod Change-Id: I844e36469b0e3b0168eecb62f6e8b0e9b2bff40e --- .../NotificationShadeWindowViewController.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java index bd13a5773833..a58387b7da60 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java @@ -107,6 +107,9 @@ public class NotificationShadeWindowViewController { private RectF mTempRect = new RectF(); private boolean mIsTrackingBarGesture = false; + // custom additions start + private boolean mDoubleTapEnabledNative; + @Inject public NotificationShadeWindowViewController( InjectionInflationController injectionInflationController, @@ -170,11 +173,17 @@ public void setupExpandedStatusBar() { break; case Settings.Secure.DOZE_TAP_SCREEN_GESTURE: mSingleTapEnabled = configuration.tapGestureEnabled(UserHandle.USER_CURRENT); + break; + case Settings.Secure.DOUBLE_TAP_TO_WAKE: + mDoubleTapEnabledNative = Settings.Secure.getIntForUser(mView.getContext().getContentResolver(), + Settings.Secure.DOUBLE_TAP_TO_WAKE, 0, UserHandle.USER_CURRENT) == 1; + break; } }; mTunerService.addTunable(tunable, Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, - Settings.Secure.DOZE_TAP_SCREEN_GESTURE); + Settings.Secure.DOZE_TAP_SCREEN_GESTURE, + Settings.Secure.DOUBLE_TAP_TO_WAKE); GestureDetector.SimpleOnGestureListener gestureListener = new GestureDetector.SimpleOnGestureListener() { @@ -190,7 +199,7 @@ public boolean onSingleTapConfirmed(MotionEvent e) { @Override public boolean onDoubleTap(MotionEvent e) { - if (mDoubleTapEnabled || mSingleTapEnabled) { + if (mDoubleTapEnabled || mSingleTapEnabled || mDoubleTapEnabledNative) { mService.wakeUpIfDozing( SystemClock.uptimeMillis(), mView, "DOUBLE_TAP"); return true;