Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21253dca authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Automerger Merge Worker
Browse files

Merge "Add a button in QSFooter to trigger PM lite" into sc-dev am: d1e56c2d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13690838

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I27731dc33f523f502794b525302de17169fe49ed
parents 7884b585 d1e56c2d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -81,6 +81,22 @@
            android:layout_height="match_parent"
            android:layout_weight="@integer/qs_footer_actions_weight"
            android:gravity="center_vertical|end" >

            <com.android.systemui.statusbar.AlphaOptimizedImageView
                android:id="@+id/pm_lite"
                android:layout_width="@dimen/qs_footer_action_button_size"
                android:layout_height="@dimen/qs_footer_action_button_size"
                android:background="?android:attr/selectableItemBackgroundBorderless"
                android:clickable="true"
                android:clipToPadding="false"
                android:contentDescription="@string/accessibility_quick_settings_edit"
                android:focusable="true"
                android:padding="@dimen/qs_footer_icon_padding"
                android:src="@*android:drawable/ic_lock_power_off"
                android:tint="?android:attr/colorForeground"
                android:visibility="gone"
                />

            <com.android.systemui.statusbar.phone.MultiUserSwitch
                android:id="@+id/multi_user_switch"
                android:layout_width="@dimen/qs_footer_action_button_size"
+2 −0
Original line number Diff line number Diff line
@@ -44,4 +44,6 @@
    <bool name="flag_toast_style">false</bool>

    <bool name="flag_navigation_bar_overlay">false</bool>

    <bool name="flag_pm_lite">false</bool>
</resources>
+12 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.qs;

import static com.android.systemui.qs.dagger.QSFlagsModule.PM_LITE_ENABLED;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Intent;
@@ -41,6 +43,7 @@ import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.ViewController;

import javax.inject.Inject;
import javax.inject.Named;

/**
 * Controller for {@link QSFooterView}.
@@ -63,6 +66,8 @@ public class QSFooterViewController extends ViewController<QSFooterView> impleme
    private final View mEdit;
    private final MultiUserSwitch mMultiUserSwitch;
    private final PageIndicator mPageIndicator;
    private final View mPowerMenuLite;
    private final boolean mShowPMLiteButton;

    private final UserInfoController.OnUserInfoChangedListener mOnUserInfoChangedListener =
            new UserInfoController.OnUserInfoChangedListener() {
@@ -123,7 +128,8 @@ public class QSFooterViewController extends ViewController<QSFooterView> impleme
            DeviceProvisionedController deviceProvisionedController, UserTracker userTracker,
            QSPanelController qsPanelController, QSDetailDisplayer qsDetailDisplayer,
            QuickQSPanelController quickQSPanelController,
            TunerService tunerService, MetricsLogger metricsLogger) {
            TunerService tunerService, MetricsLogger metricsLogger,
            @Named(PM_LITE_ENABLED) boolean showPMLiteButton) {
        super(view);
        mUserManager = userManager;
        mUserInfoController = userInfoController;
@@ -141,10 +147,15 @@ public class QSFooterViewController extends ViewController<QSFooterView> impleme
        mEdit = mView.findViewById(android.R.id.edit);
        mMultiUserSwitch = mView.findViewById(R.id.multi_user_switch);
        mPageIndicator = mView.findViewById(R.id.footer_page_indicator);
        mPowerMenuLite = mView.findViewById(R.id.pm_lite);
        mShowPMLiteButton = showPMLiteButton;
    }

    @Override
    protected void onViewAttached() {
        if (mShowPMLiteButton) {
            mPowerMenuLite.setVisibility(View.VISIBLE);
        }
        mView.addOnLayoutChangeListener(
                (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) ->
                        mView.updateAnimator(
+10 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.hardware.display.ColorDisplayManager;

import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.util.settings.GlobalSettings;

import javax.inject.Named;

@@ -31,6 +32,8 @@ import dagger.Provides;
public interface QSFlagsModule {
    String QS_LABELS_FLAG = "qs_labels_flag";
    String RBC_AVAILABLE = "rbc_available";
    String PM_LITE_ENABLED = "pm_lite";
    String PM_LITE_SETTING = "sysui_pm_lite";

    @Provides
    @SysUISingleton
@@ -46,4 +49,11 @@ public interface QSFlagsModule {
    static boolean isReduceBrightColorsAvailable(Context context) {
        return ColorDisplayManager.isReduceBrightColorsAvailable(context);
    }

    @Provides
    @SysUISingleton
    @Named(PM_LITE_ENABLED)
    static boolean isPMLiteEnabled(FeatureFlags featureFlags, GlobalSettings globalSettings) {
        return featureFlags.isPMLiteEnabled() && globalSettings.getInt(PM_LITE_SETTING, 0) != 0;
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -86,4 +86,8 @@ public class FeatureFlags {
    public boolean isNavigationBarOverlayEnabled() {
        return mFlagReader.isEnabled(R.bool.flag_navigation_bar_overlay);
    }

    public boolean isPMLiteEnabled() {
        return mFlagReader.isEnabled(R.bool.flag_pm_lite);
    }
}
Loading