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

Commit d9e78dc8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE - Merge ab/7272582" into stage-aosp-master

parents b34692c2 7d73dec2
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -109,3 +109,21 @@ android_library_import {
    name: "contextualcards",
    aars: ["libs/contextualcards.aar"],
}

filegroup {
    name: "Settings_proguard_flags",
    srcs: ["proguard.flags"],
}

// The sources for Settings need to be exposed to SettingsGoogle, etc.
// so they can run the com.android.settingslib.search.IndexableProcessor
// over all the sources together.
filegroup {
    name: "Settings_srcs",
    srcs: ["src/**/*.java"],
}

filegroup {
    name: "Settings_manifest",
    srcs: ["AndroidManifest.xml"],
}
+1 −0
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class DeviceAdminListPreferenceController extends BasePreferenceControlle
            return true;
        });
        pref.setOnPreferenceChangeListener((preference, newValue) -> false);
        pref.setSingleLineTitle(true);
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -229,7 +229,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
        if (mSubscriptionInfo == null) {
            return;
        }

        mTelephonyManager =
            mTelephonyManager.createForSubscriptionId(mSubscriptionInfo.getSubscriptionId());
        mPhoneStateListener = getPhoneStateListener();
        updateLatestAreaInfo();
        updateSubscriptionStatus();
+15 −10
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ import com.android.settingslib.widget.LayoutPreference;
 * Controller that update the battery header view
 */
public class BatteryHeaderPreferenceController extends BasePreferenceController
        implements PreferenceControllerMixin, LifecycleObserver, OnStart {
        implements PreferenceControllerMixin, LifecycleObserver, OnStart,
        BatteryPreferenceController {
    @VisibleForTesting
    static final String KEY_BATTERY_HEADER = "battery_header";
    private static final String ANNOTATION_URL = "url";
@@ -121,16 +122,20 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
                .styleActionBar(mActivity);
    }

    public void updateHeaderPreference(BatteryInfo info) {
        mBatteryPercentText.setText(formatBatteryPercentageText(info.batteryLevel));
        if (!mBatteryStatusFeatureProvider.triggerBatteryStatusUpdate(this, info)) {
    private CharSequence generateLabel(BatteryInfo info) {
        if (BatteryUtils.isBatteryDefenderOn(info)) {
                mSummary1.setText(null);
            return null;
        } else if (info.remainingLabel == null) {
                mSummary1.setText(info.statusLabel);
            return info.statusLabel;
        } else {
                mSummary1.setText(info.remainingLabel);
            return info.remainingLabel;
        }
    }

    public void updateHeaderPreference(BatteryInfo info) {
        mBatteryPercentText.setText(formatBatteryPercentageText(info.batteryLevel));
        if (!mBatteryStatusFeatureProvider.triggerBatteryStatusUpdate(this, info)) {
            mSummary1.setText(generateLabel(info));
        }

        mBatteryMeterView.setBatteryLevel(info.batteryLevel);
@@ -141,8 +146,8 @@ public class BatteryHeaderPreferenceController extends BasePreferenceController
    /**
     * Callback which receives text for the summary line.
     */
    public void updateBatteryStatus(String statusLabel) {
        mSummary1.setText(statusLabel);
    public void updateBatteryStatus(String label, BatteryInfo info) {
        mSummary1.setText(label != null ? label : generateLabel(info));
    }

    public void quickUpdateHeaderPreference() {
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.settings.fuelgauge;

/**
 * Common interface for a preference controller that updates battery status
 */
public interface BatteryPreferenceController {

    /**
     * Updates the label for the preference controller. If the label is null, the
     * implementation should revert back to the original label based on the
     * battery info.
     */
    void updateBatteryStatus(String label, BatteryInfo info);
}
Loading