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

Commit 7446235e authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge changes Ie17eedfd,Icb80843a,If1619c10,Iee23682a

* changes:
  AOD: Add wakelock for charging text while dozing
  AOD: Show charging status on AOD1
  AOD: Fix default for always-on setting
  Revert "Revert "AOD: Refactor always on configuration""
parents 394cf5e4 c1b50324
Loading
Loading
Loading
Loading
+30 −11
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.hardware;
import com.android.internal.R;

import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;

@@ -33,7 +34,8 @@ public class AmbientDisplayConfiguration {
    public boolean enabled(int user) {
        return pulseOnNotificationEnabled(user)
                || pulseOnPickupEnabled(user)
                || pulseOnDoubleTapEnabled(user);
                || pulseOnDoubleTapEnabled(user)
                || alwaysOnEnabled(user);
    }

    public boolean available() {
@@ -42,7 +44,7 @@ public class AmbientDisplayConfiguration {
    }

    public boolean pulseOnNotificationEnabled(int user) {
        return boolSetting(Settings.Secure.DOZE_ENABLED, user) && pulseOnNotificationAvailable();
        return boolSettingDefaultOn(Settings.Secure.DOZE_ENABLED, user) && pulseOnNotificationAvailable();
    }

    public boolean pulseOnNotificationAvailable() {
@@ -50,7 +52,7 @@ public class AmbientDisplayConfiguration {
    }

    public boolean pulseOnPickupEnabled(int user) {
        return boolSetting(Settings.Secure.DOZE_PULSE_ON_PICK_UP, user)
        return boolSettingDefaultOn(Settings.Secure.DOZE_PULSE_ON_PICK_UP, user)
                && pulseOnPickupAvailable();
    }

@@ -60,7 +62,7 @@ public class AmbientDisplayConfiguration {
    }

    public boolean pulseOnDoubleTapEnabled(int user) {
        return boolSetting(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, user)
        return boolSettingDefaultOn(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, user)
                && pulseOnDoubleTapAvailable();
    }

@@ -72,6 +74,16 @@ public class AmbientDisplayConfiguration {
        return mContext.getResources().getString(R.string.config_dozeDoubleTapSensorType);
    }

    public boolean alwaysOnEnabled(int user) {
        return boolSettingDefaultOff(Settings.Secure.DOZE_ALWAYS_ON, user)
                && alwaysOnAvailable();
    }

    public boolean alwaysOnAvailable() {
        // TODO: introduce config_dozeAlwaysOnAvailable. For now just debuggable builds.
        return Build.IS_DEBUGGABLE && ambientDisplayAvailable();
    }

    public String ambientDisplayComponent() {
        return mContext.getResources().getString(R.string.config_dozeComponent);
    }
@@ -80,8 +92,15 @@ public class AmbientDisplayConfiguration {
        return !TextUtils.isEmpty(ambientDisplayComponent());
    }

    private boolean boolSetting(String name, int user) {
        return Settings.Secure.getIntForUser(mContext.getContentResolver(), name, 1, user) != 0;
    private boolean boolSettingDefaultOn(String name, int user) {
        return boolSetting(name, user, 1);
    }

    private boolean boolSettingDefaultOff(String name, int user) {
        return boolSetting(name, user, 0);
    }

    private boolean boolSetting(String name, int user, int def) {
        return Settings.Secure.getIntForUser(mContext.getContentResolver(), name, def, user) != 0;
    }
}
+24 −6
Original line number Diff line number Diff line
@@ -28,25 +28,42 @@
    androidprv:layout_maxWidth="@dimen/keyguard_security_width"
    androidprv:layout_maxHeight="@dimen/keyguard_security_height"
    android:gravity="center_horizontal|top">
    <LinearLayout
    <RelativeLayout
        android:id="@+id/keyguard_clock_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|top"
        android:orientation="vertical" >
        android:layout_gravity="center_horizontal|top">
        <TextClock
            android:id="@+id/clock_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_centerHorizontal="true"
            android:layout_alignParentTop="true"
            android:textColor="@color/clock_white"
            android:singleLine="true"
            style="@style/widget_big_thin"
            android:format12Hour="@string/keyguard_widget_12_hours_format"
            android:format24Hour="@string/keyguard_widget_24_hours_format"
            android:layout_marginBottom="@dimen/bottom_text_spacing_digital" />
        <com.android.systemui.ChargingView
            android:id="@+id/battery_doze"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@id/clock_view"
            android:layout_alignBottom="@id/clock_view"
            android:layout_toEndOf="@id/clock_view"
            android:visibility="invisible"
            android:src="@drawable/ic_aod_charging_24dp"
            android:contentDescription="@string/accessibility_ambient_display_charging"
        />

        <include layout="@layout/keyguard_status_area"
            android:id="@+id/keyguard_status_area"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/clock_view" />

        <include layout="@layout/keyguard_status_area" />
        <TextView
            android:id="@+id/owner_info"
            android:layout_marginLeft="16dp"
@@ -54,12 +71,13 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/date_owner_info_margin"
            android:layout_gravity="center_horizontal"
            android:layout_centerHorizontal="true"
            android:layout_below="@id/keyguard_status_area"
            android:textColor="@color/clock_gray"
            android:textSize="@dimen/widget_label_font_size"
            android:letterSpacing="0.05"
            android:ellipsize="marquee"
            android:singleLine="true" />

    </LinearLayout>
    </RelativeLayout>
</com.android.keyguard.KeyguardStatusView>
+24 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2014 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24.0dp"
        android:height="24.0dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:pathData="M11.0,22.98l0.0,-8.98 -4.0,0.0 6.0,-13.0 0.0,9.0 4.0,0.0z"
        android:fillColor="#ffffff"/>
</vector>
+3 −0
Original line number Diff line number Diff line
@@ -565,6 +565,9 @@
    <!-- Content description of the display brightness slider (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_brightness">Display brightness</string>

    <!-- Content description of the charging indicator on Ambient Display (lower-power version of the lock screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_ambient_display_charging">Charging</string>

    <!-- Title of dialog shown when 2G-3G data usage has exceeded limit and has been disabled. [CHAR LIMIT=48] -->
    <string name="data_usage_disabled_dialog_3g_title">2G-3G data is paused</string>
    <!-- Title of dialog shown when 4G data usage has exceeded limit and has been disabled. [CHAR LIMIT=48] -->
+5 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.widget.TextClock;
import android.widget.TextView;

import com.android.internal.widget.LockPatternUtils;
import com.android.systemui.ChargingView;

import java.util.Locale;

@@ -50,6 +51,7 @@ public class KeyguardStatusView extends GridLayout {
    private TextClock mClockView;
    private TextView mOwnerInfo;
    private ViewGroup mClockContainer;
    private ChargingView mBatteryDoze;

    private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {

@@ -114,6 +116,7 @@ public class KeyguardStatusView extends GridLayout {
        mDateView.setShowCurrentUserTime(true);
        mClockView.setShowCurrentUserTime(true);
        mOwnerInfo = (TextView) findViewById(R.id.owner_info);
        mBatteryDoze = (ChargingView) findViewById(R.id.battery_doze);

        boolean shouldMarquee = KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive();
        setEnableMarquee(shouldMarquee);
@@ -273,10 +276,11 @@ public class KeyguardStatusView extends GridLayout {
        final int N = mClockContainer.getChildCount();
        for (int i = 0; i < N; i++) {
            View child = mClockContainer.getChildAt(i);
            if (child == mClockView) {
            if (child == mClockView || child == mBatteryDoze) {
                continue;
            }
            child.setAlpha(dark ? 0 : 1);
        }
        mBatteryDoze.setDark(dark);
    }
}
Loading