Merge "[DO NOT MERGE] Add placeholder for info panel in new power menu" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6725b63305
21
packages/SystemUI/res/layout/global_actions_change_panel.xml
Normal file
21
packages/SystemUI/res/layout/global_actions_change_panel.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2021 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.
|
||||
-->
|
||||
<ImageView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/global_actions_change_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
@@ -13,13 +13,12 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/global_actions_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center">
|
||||
<com.android.systemui.globalactions.GlobalActionsLayoutLite
|
||||
@@ -29,8 +28,11 @@
|
||||
android:orientation="vertical"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:background="@drawable/global_actions_lite_background"
|
||||
android:padding="@dimen/global_actions_lite_padding">
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_weight="1">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -38,6 +40,8 @@
|
||||
android:gravity="center"
|
||||
android:translationZ="@dimen/global_actions_translate"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/global_actions_lite_background"
|
||||
android:padding="@dimen/global_actions_lite_padding"
|
||||
android:layoutDirection="ltr">
|
||||
<androidx.constraintlayout.helper.widget.Flow
|
||||
android:id="@+id/list_flow"
|
||||
@@ -53,4 +57,4 @@
|
||||
app:flow_horizontalStyle="packed"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.android.systemui.globalactions.GlobalActionsLayoutLite>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -603,6 +603,8 @@
|
||||
|
||||
<!-- Whether wallet view is shown in landscape / seascape orientations -->
|
||||
<bool name="global_actions_show_landscape_wallet_view">false</bool>
|
||||
<!-- Whether global actions should show an informational message about changes in S -->
|
||||
<bool name="global_actions_show_change_info">false</bool>
|
||||
|
||||
<!-- Package name of the preferred system app to perform eSOS action -->
|
||||
<string name="config_preferredEmergencySosPackage" translatable="false"></string>
|
||||
|
||||
@@ -1106,6 +1106,7 @@
|
||||
<dimen name="global_actions_button_padding">38dp</dimen>
|
||||
<dimen name="global_actions_corner_radius">28dp</dimen>
|
||||
<dimen name="global_actions_lite_padding">24dp</dimen>
|
||||
<dimen name="global_actions_info_margin">32dp</dimen>
|
||||
|
||||
<!-- The maximum offset in either direction that elements are moved horizontally to prevent
|
||||
burn-in on AOD. -->
|
||||
|
||||
@@ -2966,4 +2966,7 @@
|
||||
|
||||
<!-- Content description for a chip in the status bar showing that the user is currently on a phone call. [CHAR LIMIT=NONE] -->
|
||||
<string name="ongoing_phone_call_content_description">Ongoing phone call</string>
|
||||
|
||||
<!-- URL for more information about changes in global actions -->
|
||||
<string name="global_actions_change_url" translatable="false"></string>
|
||||
</resources>
|
||||
|
||||
@@ -151,6 +151,7 @@ public class GlobalActionsDialog extends GlobalActionsDialogLite
|
||||
iWindowManager,
|
||||
backgroundExecutor,
|
||||
uiEventLogger,
|
||||
null,
|
||||
ringerModeTracker, sysUiState, handler);
|
||||
|
||||
mLockPatternUtils = lockPatternUtils;
|
||||
@@ -298,7 +299,7 @@ public class GlobalActionsDialog extends GlobalActionsDialogLite
|
||||
super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions,
|
||||
adapter, overflowAdapter, depthController, sysuiColorExtractor,
|
||||
statusBarService, notificationShadeWindowController, sysuiState,
|
||||
onRotateCallback, keyguardShowing, powerAdapter, uiEventLogger);
|
||||
onRotateCallback, keyguardShowing, powerAdapter, uiEventLogger, null);
|
||||
mWalletFactory = walletFactory;
|
||||
|
||||
// Update window attributes
|
||||
|
||||
@@ -188,6 +188,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
private final UiEventLogger mUiEventLogger;
|
||||
private final NotificationShadeDepthController mDepthController;
|
||||
private final SysUiState mSysUiState;
|
||||
private final GlobalActionsInfoProvider mInfoProvider;
|
||||
|
||||
// Used for RingerModeTracker
|
||||
private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this);
|
||||
@@ -320,6 +321,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
IWindowManager iWindowManager,
|
||||
@Background Executor backgroundExecutor,
|
||||
UiEventLogger uiEventLogger,
|
||||
GlobalActionsInfoProvider infoProvider,
|
||||
RingerModeTracker ringerModeTracker, SysUiState sysUiState, @Main Handler handler) {
|
||||
mContext = context;
|
||||
mWindowManagerFuncs = windowManagerFuncs;
|
||||
@@ -339,6 +341,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
mTelecomManager = telecomManager;
|
||||
mMetricsLogger = metricsLogger;
|
||||
mUiEventLogger = uiEventLogger;
|
||||
mInfoProvider = infoProvider;
|
||||
mDepthController = depthController;
|
||||
mSysuiColorExtractor = colorExtractor;
|
||||
mStatusBarService = statusBarService;
|
||||
@@ -621,7 +624,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
mAdapter, mOverflowAdapter,
|
||||
mDepthController, mSysuiColorExtractor,
|
||||
mStatusBarService, mNotificationShadeWindowController,
|
||||
mSysUiState, this::onRotate, mKeyguardShowing, mPowerAdapter, mUiEventLogger);
|
||||
mSysUiState, this::onRotate, mKeyguardShowing, mPowerAdapter, mUiEventLogger,
|
||||
mInfoProvider);
|
||||
|
||||
dialog.setOnDismissListener(this);
|
||||
dialog.setOnShowListener(this);
|
||||
@@ -2095,6 +2099,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
private Dialog mPowerOptionsDialog;
|
||||
protected final Runnable mOnRotateCallback;
|
||||
private UiEventLogger mUiEventLogger;
|
||||
private GlobalActionsInfoProvider mInfoProvider;
|
||||
|
||||
protected ViewGroup mContainer;
|
||||
|
||||
@@ -2104,7 +2109,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
|
||||
NotificationShadeWindowController notificationShadeWindowController,
|
||||
SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing,
|
||||
MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger) {
|
||||
MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger,
|
||||
@Nullable GlobalActionsInfoProvider infoProvider) {
|
||||
super(context, themeRes);
|
||||
mContext = context;
|
||||
mAdapter = adapter;
|
||||
@@ -2118,6 +2124,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
mOnRotateCallback = onRotateCallback;
|
||||
mKeyguardShowing = keyguardShowing;
|
||||
mUiEventLogger = uiEventLogger;
|
||||
mInfoProvider = infoProvider;
|
||||
|
||||
// Window initialization
|
||||
Window window = getWindow();
|
||||
@@ -2215,6 +2222,10 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
|
||||
mBackgroundDrawable = new ScrimDrawable();
|
||||
mScrimAlpha = 1.0f;
|
||||
}
|
||||
|
||||
if (mInfoProvider != null && mInfoProvider.shouldShowMessage()) {
|
||||
mInfoProvider.addPanel(mContext, mContainer, mAdapter.getCount(), () -> dismiss());
|
||||
}
|
||||
}
|
||||
|
||||
protected void fixNavBarClipping() {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.systemui.globalactions
|
||||
|
||||
import android.content.Context
|
||||
import android.service.quickaccesswallet.QuickAccessWalletClient
|
||||
import android.view.ViewGroup
|
||||
import com.android.systemui.controls.controller.ControlsController
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import javax.inject.Inject
|
||||
|
||||
// Empty class, will be overridden for relevant devices
|
||||
class GlobalActionsInfoProvider @Inject constructor(
|
||||
private val context: Context,
|
||||
private val walletClient: QuickAccessWalletClient,
|
||||
private val controlsController: ControlsController,
|
||||
private val activityStarter: ActivityStarter
|
||||
) {
|
||||
|
||||
fun addPanel(context: Context, parent: ViewGroup, nActions: Int, dismissParent: Runnable) { }
|
||||
|
||||
fun shouldShowMessage(): Boolean {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,7 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
|
||||
@Mock private IWindowManager mWindowManager;
|
||||
@Mock private Executor mBackgroundExecutor;
|
||||
@Mock private UiEventLogger mUiEventLogger;
|
||||
@Mock private GlobalActionsInfoProvider mInfoProvider;
|
||||
@Mock private RingerModeTracker mRingerModeTracker;
|
||||
@Mock private RingerModeLiveData mRingerModeLiveData;
|
||||
@Mock private SysUiState mSysUiState;
|
||||
@@ -146,6 +147,7 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
|
||||
mWindowManager,
|
||||
mBackgroundExecutor,
|
||||
mUiEventLogger,
|
||||
mInfoProvider,
|
||||
mRingerModeTracker,
|
||||
mSysUiState,
|
||||
mHandler
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.systemui.globalactions
|
||||
|
||||
import android.service.quickaccesswallet.QuickAccessWalletClient
|
||||
import android.testing.AndroidTestingRunner
|
||||
import android.view.ViewGroup
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.controls.controller.ControlsController
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
import org.mockito.ArgumentMatchers.anyObject
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.mock
|
||||
import org.mockito.Mockito.verify
|
||||
import org.mockito.Mockito.never
|
||||
import org.mockito.MockitoAnnotations
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidTestingRunner::class)
|
||||
class GlobalActionsInfoProviderTest : SysuiTestCase() {
|
||||
|
||||
@Mock
|
||||
private lateinit var walletClient: QuickAccessWalletClient
|
||||
@Mock
|
||||
private lateinit var controlsController: ControlsController
|
||||
@Mock
|
||||
private lateinit var activityStarter: ActivityStarter
|
||||
|
||||
private lateinit var infoProvider: GlobalActionsInfoProvider
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.initMocks(this)
|
||||
infoProvider = GlobalActionsInfoProvider(
|
||||
context,
|
||||
walletClient,
|
||||
controlsController,
|
||||
activityStarter
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAddPanel_doesNothing() {
|
||||
val parent = mock(ViewGroup::class.java)
|
||||
infoProvider.addPanel(context, parent, 1, { })
|
||||
verify(parent, never()).addView(anyObject(), anyInt())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testShouldShowPanel() {
|
||||
assertThat(infoProvider.shouldShowMessage()).isFalse()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user