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

Commit 6ee6b37c authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "QS Wallet priority placement" into sc-dev

parents 025e7c2d cf72270a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -98,7 +98,10 @@ class QuickAccessWalletServiceInfo {
        intent.setPackage(packageName);
        List<ResolveInfo> resolveInfos =
                context.getPackageManager().queryIntentServices(intent,
                        PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA);
                        PackageManager.MATCH_DIRECT_BOOT_AWARE
                        | PackageManager.MATCH_DIRECT_BOOT_UNAWARE
                        | PackageManager.MATCH_DEFAULT_ONLY
                        | PackageManager.GET_META_DATA);
        return resolveInfos.isEmpty() ? null : resolveInfos.get(0).serviceInfo;
    }

+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.DataSaverController;
import com.android.systemui.statusbar.policy.DeviceControlsController;
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.WalletController;
import com.android.systemui.util.settings.SecureSettings;

import javax.inject.Named;
@@ -63,6 +64,7 @@ public interface QSModule {
            CastController castController,
            ReduceBrightColorsController reduceBrightColorsController,
            DeviceControlsController deviceControlsController,
            WalletController walletController,
            @Named(RBC_AVAILABLE) boolean isReduceBrightColorsAvailable) {
        AutoTileManager manager = new AutoTileManager(
                context,
@@ -77,6 +79,7 @@ public interface QSModule {
                castController,
                reduceBrightColorsController,
                deviceControlsController,
                walletController,
                isReduceBrightColorsAvailable
        );
        manager.init();
+18 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.statusbar.policy.DataSaverController.Listener;
import com.android.systemui.statusbar.policy.DeviceControlsController;
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.HotspotController.Callback;
import com.android.systemui.statusbar.policy.WalletController;
import com.android.systemui.util.UserAwareController;
import com.android.systemui.util.settings.SecureSettings;

@@ -60,6 +61,7 @@ public class AutoTileManager implements UserAwareController {
    public static final String NIGHT = "night";
    public static final String CAST = "cast";
    public static final String DEVICE_CONTROLS = "controls";
    public static final String WALLET = "wallet";
    public static final String BRIGHTNESS = "reduce_brightness";
    static final String SETTING_SEPARATOR = ":";

@@ -77,6 +79,7 @@ public class AutoTileManager implements UserAwareController {
    private final NightDisplayListener mNightDisplayListener;
    private final CastController mCastController;
    private final DeviceControlsController mDeviceControlsController;
    private final WalletController mWalletController;
    private final ReduceBrightColorsController mReduceBrightColorsController;
    private final boolean mIsReduceBrightColorsAvailable;
    private final ArrayList<AutoAddSetting> mAutoAddSettingList = new ArrayList<>();
@@ -92,6 +95,7 @@ public class AutoTileManager implements UserAwareController {
            CastController castController,
            ReduceBrightColorsController reduceBrightColorsController,
            DeviceControlsController deviceControlsController,
            WalletController walletController,
            @Named(RBC_AVAILABLE) boolean isReduceBrightColorsAvailable) {
        mContext = context;
        mHost = host;
@@ -107,6 +111,7 @@ public class AutoTileManager implements UserAwareController {
        mReduceBrightColorsController = reduceBrightColorsController;
        mIsReduceBrightColorsAvailable = isReduceBrightColorsAvailable;
        mDeviceControlsController = deviceControlsController;
        mWalletController = walletController;
    }

    /**
@@ -146,6 +151,9 @@ public class AutoTileManager implements UserAwareController {
        if (!mAutoTracker.isAdded(DEVICE_CONTROLS)) {
            mDeviceControlsController.setCallback(mDeviceControlsCallback);
        }
        if (!mAutoTracker.isAdded(WALLET)) {
            initWalletController();
        }

        int settingsN = mAutoAddSettingList.size();
        for (int i = 0; i < settingsN; i++) {
@@ -294,6 +302,16 @@ public class AutoTileManager implements UserAwareController {
        }
    };

    private void initWalletController() {
        if (mAutoTracker.isAdded(WALLET)) return;
        Integer position = mWalletController.getWalletPosition();

        if (position != null) {
            mHost.addTile(WALLET, position);
            mAutoTracker.setTileAdded(WALLET);
        }
    }

    @VisibleForTesting
    final NightDisplayListener.Callback mNightDisplayCallback =
            new NightDisplayListener.Callback() {
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public class DeviceControlsControllerImpl @Inject constructor(

    companion object {
        private const val TAG = "DeviceControlsControllerImpl"
        internal const val QS_PRIORITY_POSITION = 3
        internal const val QS_PRIORITY_POSITION = 2
        internal const val QS_DEFAULT_POSITION = POSITION_AT_END

        internal const val PREFS_CONTROLS_SEEDING_COMPLETED = "SeedingCompleted"
+25 −0
Original line number Diff line number Diff line
/*
 * 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.statusbar.policy

/**
 * Supports adding a Quick Access Wallet QS tile
 */
interface WalletController {
    /** @return valid position or null to indicate no tile should be set */
    fun getWalletPosition(): Int?
}
Loading