Skip to content

Commit

Permalink
base: SystemUI: tuner: keyguard battery percent on charging
Browse files Browse the repository at this point in the history
by default battery percent display in status bar is forced
on keyguard when charging

Change-Id: Icff8177fff2934123103cdbc6a931f2c2db9bfd6
Signed-off-by: sayan7848 <sayan7848@gmail.com>
  • Loading branch information
maxwen authored and sayan7848 committed Mar 22, 2019
1 parent f61a53f commit 1c50f8b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/SystemUI/res/values/custom_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,7 @@
<!-- App Picker Tile -->
<string name="quick_settings_apppicker">App Picker</string>

<string name="tuner_keyguard_battery_percent_title">Show battery percent</string>
<string name="tuner_keyguard_battery_percent_summary">Force show battery percent in status bar on charging</string>

</resources>
6 changes: 6 additions & 0 deletions packages/SystemUI/res/xml/lockscreen_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,10 @@
android:title="@string/lockscreen_unlock_right"
sysui:defValue="true" />

<com.android.systemui.tuner.TunerSwitch
android:key="sysui_keyguard_battery_percent"
android:title="@string/tuner_keyguard_battery_percent_title"
android:summary="@string/tuner_keyguard_battery_percent_summary"
sysui:defValue="true" />

</PreferenceScreen>
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;

/**
* The header group on Keyguard.
Expand Down Expand Up @@ -102,6 +103,11 @@ public class KeyguardStatusBarView extends RelativeLayout
private ViewGroup mStatusIconArea;
private int mLayoutState = LAYOUT_NONE;

private boolean mMultiSwitchEnabled;

// tuner switch
private static final String KEYGUARD_SHOW_PERCENT_ON_CHARGING = "sysui_keyguard_battery_percent";

/**
* Draw this many pixels into the left/right side of the cutout to optimally use the space
*/
Expand Down Expand Up @@ -215,6 +221,10 @@ private void updateVisibilities() {
mMultiUserSwitch.setVisibility(View.GONE);
}
}

final boolean showPercentOnCharging = Dependency.get(TunerService.class)
.getValue(KEYGUARD_SHOW_PERCENT_ON_CHARGING, 1) == 1;

if (mCarrierLabel != null) {
if (mShowCarrierLabel == 1 || mShowCarrierLabel == 3) {
mCarrierLabel.setVisibility(mHideContents ? View.INVISIBLE : View.VISIBLE);
Expand All @@ -224,7 +234,7 @@ private void updateVisibilities() {
mCarrierLabel.setSelected(false);
}
}
mBatteryView.setForceShowPercent(mBatteryCharging && mShowPercentAvailable);
mBatteryView.setForceShowPercent(showPercentOnCharging && mBatteryCharging && mShowPercentAvailable);
}

private void updateSystemIconsLayoutParams() {
Expand Down

0 comments on commit 1c50f8b

Please sign in to comment.