diff options
14 files changed, 229 insertions, 111 deletions
diff --git a/api/current.txt b/api/current.txt index d3d82160edd6..1d251ec4dbf3 100644 --- a/api/current.txt +++ b/api/current.txt @@ -2750,15 +2750,12 @@ package android.accounts { method public android.os.Bundle addAccountFromCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle confirmCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle editProperties(android.accounts.AccountAuthenticatorResponse, java.lang.String); - method public android.os.Bundle finishSession(android.accounts.AccountAuthenticatorResponse, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; method public android.os.Bundle getAccountCredentialsForCloning(android.accounts.AccountAuthenticatorResponse, android.accounts.Account) throws android.accounts.NetworkErrorException; method public android.os.Bundle getAccountRemovalAllowed(android.accounts.AccountAuthenticatorResponse, android.accounts.Account) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle getAuthToken(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract java.lang.String getAuthTokenLabel(java.lang.String); method public final android.os.IBinder getIBinder(); method public abstract android.os.Bundle hasFeatures(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String[]) throws android.accounts.NetworkErrorException; - method public android.os.Bundle startAddAccountSession(android.accounts.AccountAuthenticatorResponse, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle) throws android.accounts.NetworkErrorException; - method public android.os.Bundle startUpdateCredentialsSession(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle updateCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; field public static final java.lang.String KEY_CUSTOM_TOKEN_EXPIRY = "android.accounts.expiry"; } @@ -2796,7 +2793,6 @@ package android.accounts { method public void clearPassword(android.accounts.Account); method public android.accounts.AccountManagerFuture<android.os.Bundle> confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); method public android.accounts.AccountManagerFuture<android.os.Bundle> editProperties(java.lang.String, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); - method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); method public static android.accounts.AccountManager get(android.content.Context); method public android.accounts.Account[] getAccounts(); method public android.accounts.Account[] getAccountsByType(java.lang.String); @@ -2824,8 +2820,6 @@ package android.accounts { method public void setAuthToken(android.accounts.Account, java.lang.String, java.lang.String); method public void setPassword(android.accounts.Account, java.lang.String); method public void setUserData(android.accounts.Account, java.lang.String, java.lang.String); - method public android.accounts.AccountManagerFuture<android.os.Bundle> startAddAccountSession(java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); - method public android.accounts.AccountManagerFuture<android.os.Bundle> startUpdateCredentialsSession(android.accounts.Account, java.lang.String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); method public android.accounts.AccountManagerFuture<android.os.Bundle> updateCredentials(android.accounts.Account, java.lang.String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); field public static final java.lang.String ACTION_AUTHENTICATOR_INTENT = "android.accounts.AccountAuthenticator"; field public static final java.lang.String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator"; @@ -2842,8 +2836,6 @@ package android.accounts { field public static final java.lang.String KEY_ACCOUNT_AUTHENTICATOR_RESPONSE = "accountAuthenticatorResponse"; field public static final java.lang.String KEY_ACCOUNT_MANAGER_RESPONSE = "accountManagerResponse"; field public static final java.lang.String KEY_ACCOUNT_NAME = "authAccount"; - field public static final java.lang.String KEY_ACCOUNT_SESSION_BUNDLE = "accountSessionBundle"; - field public static final java.lang.String KEY_ACCOUNT_STATUS_TOKEN = "accountStatusToken"; field public static final java.lang.String KEY_ACCOUNT_TYPE = "accountType"; field public static final java.lang.String KEY_ANDROID_PACKAGE_NAME = "androidPackageName"; field public static final java.lang.String KEY_AUTHENTICATOR_TYPES = "authenticator_types"; diff --git a/api/test-current.txt b/api/test-current.txt index 62dc46a522f8..91dcf3424ce4 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -2750,15 +2750,12 @@ package android.accounts { method public android.os.Bundle addAccountFromCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle confirmCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle editProperties(android.accounts.AccountAuthenticatorResponse, java.lang.String); - method public android.os.Bundle finishSession(android.accounts.AccountAuthenticatorResponse, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; method public android.os.Bundle getAccountCredentialsForCloning(android.accounts.AccountAuthenticatorResponse, android.accounts.Account) throws android.accounts.NetworkErrorException; method public android.os.Bundle getAccountRemovalAllowed(android.accounts.AccountAuthenticatorResponse, android.accounts.Account) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle getAuthToken(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract java.lang.String getAuthTokenLabel(java.lang.String); method public final android.os.IBinder getIBinder(); method public abstract android.os.Bundle hasFeatures(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String[]) throws android.accounts.NetworkErrorException; - method public android.os.Bundle startAddAccountSession(android.accounts.AccountAuthenticatorResponse, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle) throws android.accounts.NetworkErrorException; - method public android.os.Bundle startUpdateCredentialsSession(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; method public abstract android.os.Bundle updateCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, java.lang.String, android.os.Bundle) throws android.accounts.NetworkErrorException; field public static final java.lang.String KEY_CUSTOM_TOKEN_EXPIRY = "android.accounts.expiry"; } @@ -2796,7 +2793,6 @@ package android.accounts { method public void clearPassword(android.accounts.Account); method public android.accounts.AccountManagerFuture<android.os.Bundle> confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); method public android.accounts.AccountManagerFuture<android.os.Bundle> editProperties(java.lang.String, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); - method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); method public static android.accounts.AccountManager get(android.content.Context); method public android.accounts.Account[] getAccounts(); method public android.accounts.Account[] getAccountsByType(java.lang.String); @@ -2824,8 +2820,6 @@ package android.accounts { method public void setAuthToken(android.accounts.Account, java.lang.String, java.lang.String); method public void setPassword(android.accounts.Account, java.lang.String); method public void setUserData(android.accounts.Account, java.lang.String, java.lang.String); - method public android.accounts.AccountManagerFuture<android.os.Bundle> startAddAccountSession(java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); - method public android.accounts.AccountManagerFuture<android.os.Bundle> startUpdateCredentialsSession(android.accounts.Account, java.lang.String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); method public android.accounts.AccountManagerFuture<android.os.Bundle> updateCredentials(android.accounts.Account, java.lang.String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler); field public static final java.lang.String ACTION_AUTHENTICATOR_INTENT = "android.accounts.AccountAuthenticator"; field public static final java.lang.String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator"; @@ -2842,8 +2836,6 @@ package android.accounts { field public static final java.lang.String KEY_ACCOUNT_AUTHENTICATOR_RESPONSE = "accountAuthenticatorResponse"; field public static final java.lang.String KEY_ACCOUNT_MANAGER_RESPONSE = "accountManagerResponse"; field public static final java.lang.String KEY_ACCOUNT_NAME = "authAccount"; - field public static final java.lang.String KEY_ACCOUNT_SESSION_BUNDLE = "accountSessionBundle"; - field public static final java.lang.String KEY_ACCOUNT_STATUS_TOKEN = "accountStatusToken"; field public static final java.lang.String KEY_ACCOUNT_TYPE = "accountType"; field public static final java.lang.String KEY_ANDROID_PACKAGE_NAME = "androidPackageName"; field public static final java.lang.String KEY_AUTHENTICATOR_TYPES = "authenticator_types"; diff --git a/core/java/android/accounts/AbstractAccountAuthenticator.java b/core/java/android/accounts/AbstractAccountAuthenticator.java index a312e3f5b6a7..690e674a4812 100644 --- a/core/java/android/accounts/AbstractAccountAuthenticator.java +++ b/core/java/android/accounts/AbstractAccountAuthenticator.java @@ -25,6 +25,7 @@ import android.content.pm.PackageManager; import android.content.Context; import android.content.Intent; import android.Manifest; +import android.annotation.SystemApi; import android.util.Log; import java.util.Arrays; @@ -762,7 +763,9 @@ public abstract class AbstractAccountAuthenticator { * @throws NetworkErrorException if the authenticator could not honor the * request due to a network error * @see #finishSession(AccountAuthenticatorResponse, String, Bundle) + * @hide */ + @SystemApi public Bundle startAddAccountSession( final AccountAuthenticatorResponse response, final String accountType, @@ -818,7 +821,9 @@ public abstract class AbstractAccountAuthenticator { * @throws NetworkErrorException if the authenticator could not honor the * request due to a network error * @see #finishSession(AccountAuthenticatorResponse, String, Bundle) + * @hide */ + @SystemApi public Bundle startUpdateCredentialsSession( final AccountAuthenticatorResponse response, final Account account, @@ -870,7 +875,9 @@ public abstract class AbstractAccountAuthenticator { * </ul> * @throws NetworkErrorException * @see #startAddAccountSession and #startUpdateCredentialsSession + * @hide */ + @SystemApi public Bundle finishSession( final AccountAuthenticatorResponse response, final String accountType, diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index ada1ac268fc0..2449ee51c682 100644 --- a/core/java/android/accounts/AccountManager.java +++ b/core/java/android/accounts/AccountManager.java @@ -19,6 +19,7 @@ package android.accounts; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.Size; +import android.annotation.SystemApi; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -244,14 +245,18 @@ public class AccountManager { * Bundle key used for a {@link Bundle} in result from * {@link #startAddAccountSession} and friends which returns session data * for installing an account later. + * @hide */ + @SystemApi public static final String KEY_ACCOUNT_SESSION_BUNDLE = "accountSessionBundle"; /** * Bundle key used for the {@link String} account status token in result * from {@link #startAddAccountSession} and friends which returns * information about a particular account. + * @hide */ + @SystemApi public static final String KEY_ACCOUNT_STATUS_TOKEN = "accountStatusToken"; public static final String ACTION_AUTHENTICATOR_INTENT = @@ -2667,7 +2672,9 @@ public class AccountManager { * trouble * </ul> * @see #finishSession + * @hide */ + @SystemApi public AccountManagerFuture<Bundle> startAddAccountSession( final String accountType, final String authTokenType, @@ -2749,7 +2756,9 @@ public class AccountManager { * trouble * </ul> * @see #finishSession + * @hide */ + @SystemApi public AccountManagerFuture<Bundle> startUpdateCredentialsSession( final Account account, final String authTokenType, @@ -2818,7 +2827,9 @@ public class AccountManager { * trouble * </ul> * @see #startAddAccountSession and #startUpdateCredentialsSession + * @hide */ + @SystemApi public AccountManagerFuture<Bundle> finishSession( final Bundle sessionBundle, final Activity activity, diff --git a/core/res/res/drawable/ic_notification_alert.xml b/core/res/res/drawable/ic_notification_alert.xml new file mode 100644 index 000000000000..d17dfc1ec8cf --- /dev/null +++ b/core/res/res/drawable/ic_notification_alert.xml @@ -0,0 +1,33 @@ +<!-- +Copyright (C) 2016 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="M18.4,2.2L17.0,3.6c2.0,1.4 3.3,3.7 3.5,6.4l2.0,0.0C22.3,6.8 20.8,4.0 18.4,2.2z" + android:fillColor="#231F20"/> + <path + android:pathData="M7.1,3.6L5.7,2.2C3.3,4.0 1.7,6.8 1.5,10.0l2.0,0.0C3.7,7.3 5.0,5.0 7.1,3.6z" + android:fillColor="#231F20"/> + <path + android:pathData="M18.5,10.5c0.0,-3.1 -2.1,-5.6 -5.0,-6.3L13.5,3.5C13.5,2.7 12.8,2.0 12.0,2.0s-1.5,0.7 -1.5,1.5l0.0,0.7c-2.9,0.7 -5.0,3.2 -5.0,6.3L5.5,16.0l-2.0,2.0l0.0,1.0l17.0,0.0l0.0,-1.0l-2.0,-2.0L18.5,10.5zM13.0,16.5l-2.0,0.0l0.0,-2.0l2.0,0.0L13.0,16.5zM13.0,12.5l-2.0,0.0l0.0,-6.0l2.0,0.0L13.0,12.5z" + android:fillColor="#231F20"/> + <path + android:pathData="M12.0,22.0c1.1,0.0 2.0,-0.9 2.0,-2.0L10.0,20.0C10.0,21.1 10.9,22.0 12.0,22.0z" + android:fillColor="#231F20"/> +</vector> diff --git a/core/res/res/drawable/ic_notification_block.xml b/core/res/res/drawable/ic_notification_block.xml new file mode 100644 index 000000000000..276907401d5a --- /dev/null +++ b/core/res/res/drawable/ic_notification_block.xml @@ -0,0 +1,25 @@ +<!-- +Copyright (C) 2016 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:fillColor="#FF000000" + android:pathData="M12.0,2.0C6.48,2.0 2.0,6.48 2.0,12.0s4.48,10.0 10.0,10.0 10.0,-4.48 10.0,-10.0S17.52,2.0 12.0,2.0zM4.0,12.0c0.0,-4.42 3.58,-8.0 8.0,-8.0 1.85,0.0 3.5,0.63 4.9,1.69L5.69,16.9C4.63,15.55 4.0,13.85 4.0,12.0zm8.0,8.0c-1.85,0.0 -3.55,-0.63 -4.9,-1.69L18.31,7.1C19.37,8.45 20.0,10.15 20.0,12.0c0.0,4.42 -3.58,8.0 -8.0,8.0z"/> +</vector> diff --git a/packages/SystemUI/res/layout/notification_guts.xml b/packages/SystemUI/res/layout/notification_guts.xml index 071b7c8a6da8..03451b43b5e2 100644 --- a/packages/SystemUI/res/layout/notification_guts.xml +++ b/packages/SystemUI/res/layout/notification_guts.xml @@ -25,15 +25,15 @@ android:gravity="top|start" android:orientation="vertical" android:paddingStart="@*android:dimen/notification_content_margin_start" - android:paddingEnd="@*android:dimen/notification_content_margin_end" - android:background="@color/notification_guts_text_color" > + android:paddingEnd="8dp" + android:background="@color/notification_guts_bg_color" > <!-- header --> <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingBottom="8dp" - android:paddingTop="8dp" + android:layout_height="30dp" + android:paddingTop="9dp" + android:paddingEnd="8dp" android:id="@+id/notification_guts_header" android:orientation="horizontal" android:layout_gravity="center_vertical|start"> @@ -42,25 +42,21 @@ android:id="@android:id/icon" android:layout_width="18dp" android:layout_height="18dp" - android:layout_marginEnd="3dp" + android:layout_marginEnd="6dp" android:src="@android:drawable/arrow_down_float" /> <TextView - android:id="@+id/pkgname" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="@android:style/TextAppearance.Material.Notification.Info" - android:layout_marginStart="3dp" - android:layout_marginEnd="4dp" - android:textColor="@color/notification_guts_title_color" /> + android:id="@+id/pkgname" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + style="@style/TextAppearance.NotificationGuts.Header" /> <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/debug_info" - android:layout_weight="0" - android:textAppearance="@android:style/TextAppearance.Material.Notification.Time" - android:layout_gravity="bottom|start" - android:visibility="gone" - android:textColor="#ffffff" /> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/debug_info" + android:layout_weight="0" + style="@style/TextAppearance.NotificationGuts.Header" + android:layout_gravity="bottom|start" + android:visibility="gone" /> </LinearLayout> <!-- Importance slider --> <LinearLayout @@ -70,16 +66,17 @@ android:orientation="vertical" android:clickable="false" android:focusable="false" - android:paddingBottom="8dip"> + android:paddingBottom="8dip" + android:paddingEnd="8dp" > <TextView android:id="@+id/title" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" - android:textAppearance="@android:style/TextAppearance.Material.Subhead" - android:textColor="@color/notification_guts_text_color" + style="@style/TextAppearance.NotificationGuts.Primary" android:ellipsize="marquee" - android:fadingEdge="horizontal"/> + android:fadingEdge="horizontal" + android:paddingBottom="2dp"/> <TextView android:id="@+id/summary" @@ -87,38 +84,41 @@ android:layout_height="wrap_content" android:layout_alignStart="@android:id/title" android:textAlignment="viewStart" - android:textAppearance="@android:style/TextAppearance.Material.Body1" - android:textColor="@color/notification_guts_title_color" + style="@style/TextAppearance.NotificationGuts.Secondary" android:maxLines="3" - android:minLines="2" /> + android:minLines="2" + android:paddingBottom="4dp" /> <FrameLayout android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="48dp" android:paddingTop="8dp" > <ImageView android:id="@+id/low_importance" - android:src="@android:drawable/ic_menu_close_clear_cancel" + android:src="@*android:drawable/ic_notification_block" android:layout_gravity="center_vertical|start" android:layout_width="24dp" android:layout_height="24dp" /> <SeekBar android:id="@+id/seekbar" - android:layout_marginStart="24dp" - android:layout_marginEnd="24dp" + android:layout_marginStart="56dp" + android:layout_marginEnd="56dp" android:layout_gravity="center_vertical" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="48dp" android:focusable="true" android:background="#00ffffff" - android:thumbTint="@android:color/white" - android:progressTint="@android:color/white" /> + android:progressBackgroundTint="@color/notification_guts_secondary_slider_color" + android:thumbTint="@color/notification_guts_slider_color" + android:progressTint="@color/notification_guts_slider_color" + style="@android:style/Widget.Material.SeekBar.Discrete" + android:tickMarkTint="@android:color/black" /> <ImageView android:id="@+id/max_importance" - android:src="@android:drawable/ic_popup_reminder" + android:src="@*android:drawable/ic_notification_alert" android:layout_gravity="center_vertical|end" android:layout_width="24dp" android:layout_height="24dp"/> @@ -128,19 +128,22 @@ <RadioGroup android:id="@+id/apply_to" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingTop="8dp"> + android:layout_height="wrap_content" > <RadioButton android:id="@+id/apply_to_topic" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/notification_guts_text_color" - android:visibility="gone"/> + android:layout_height="48dp" + style="@style/TextAppearance.NotificationGuts.Primary" + android:visibility="gone" + android:buttonTint="#858383" + /> <RadioButton android:id="@+id/apply_to_app" android:layout_width="wrap_content" - android:layout_height="wrap_content" + android:layout_height="48dp" android:text="@string/apply_to_app" - android:textColor="@color/notification_guts_text_color" - android:visibility="gone"/> + style="@style/TextAppearance.NotificationGuts.Primary" + android:visibility="gone" + android:buttonTint="#858383" + /> </RadioGroup> </LinearLayout> <!-- buttons --> @@ -148,29 +151,30 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="end" - android:paddingTop="8dp" - android:paddingBottom="16dp" > + android:paddingBottom="8dp" > <TextView android:id="@+id/more_settings" android:text="@string/notification_more_settings" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.NotificationGuts" + android:layout_height="48dp" + style="@style/TextAppearance.NotificationGuts.Button" android:background="@drawable/btn_borderless_rect" android:gravity="center" - android:paddingEnd="24dp" - android:paddingStart="12dp" + android:paddingEnd="8dp" + android:paddingStart="8dp" android:focusable="true" /> <TextView android:id="@+id/done" android:text="@string/notification_done" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.NotificationGuts" + android:layout_height="48dp" + style="@style/TextAppearance.NotificationGuts.Button" android:background="@drawable/btn_borderless_rect" android:gravity="center" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" android:focusable="true"/> </LinearLayout> </com.android.systemui.statusbar.NotificationGuts> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 0a56f92e04cd..61c71dd445b9 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -100,10 +100,9 @@ <color name="current_user_border_color">@color/system_accent_color</color> <!-- The "inside" of a notification, reached via longpress --> - <color name="notification_guts_bg_color">@*android:color/material_deep_teal_500</color> - <color name="notification_guts_title_color">#B2DFDB</color> - <color name="notification_guts_text_color">#FFFFFFFF</color> - <color name="notification_guts_btn_color">#FFFFFFFF</color> + <color name="notification_guts_bg_color">@*android:color/material_grey_50</color> + <color name="notification_guts_slider_color">@*android:color/material_deep_teal_500</color> + <color name="notification_guts_secondary_slider_color">#858383</color> <color name="assist_orb_color">#ffffff</color> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 527b6380d2f3..4329f7830c4d 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -319,10 +319,30 @@ <style name="TextAppearance.NotificationGuts"> <item name="android:textSize">14sp</item> - <item name="android:textColor">@color/notification_guts_btn_color</item> + <item name="android:fontFamily">sans-serif-medium</item> + <item name="android:textColor">@android:color/black</item> + </style> + + <style name="TextAppearance.NotificationGuts.Header"> + <item name="android:alpha">.38</item> + <item name="android:textSize">12sp</item> + </style> + + <style name="TextAppearance.NotificationGuts.Secondary"> + <item name="android:alpha">.54</item> + </style> + + <style name="TextAppearance.NotificationGuts.Primary"> + <item name="android:alpha">.87</item> + <item name="android:textSize">16sp</item> + </style> + + <style name="TextAppearance.NotificationGuts.Button"> + <item name="android:textSize">14sp</item> <item name="android:textAllCaps">true</item> <item name="android:fontFamily">sans-serif-medium</item> <item name="android:gravity">center</item> + <item name="android:textColor">@*android:color/material_deep_teal_500</item> </style> </resources> diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java index 11f9e2d58c31..f345d7e91ace 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -2312,6 +2312,14 @@ public class AccountManagerService } final int uid = Binder.getCallingUid(); + // Only allow system to start session + if (!isSystemUid(uid)) { + String msg = String.format( + "uid %s cannot stat add account session.", + uid); + throw new SecurityException(msg); + } + final int userId = UserHandle.getUserId(uid); if (!canUserModifyAccounts(userId, uid)) { try { @@ -2499,6 +2507,14 @@ public class AccountManagerService } final int uid = Binder.getCallingUid(); + // Only allow system to finish session + if (!isSystemUid(uid)) { + String msg = String.format( + "uid %s cannot finish session.", + uid); + throw new SecurityException(msg); + } + final int userId = UserHandle.getUserId(uid); if (!canUserModifyAccounts(userId, uid)) { sendErrorResponse(response, @@ -2717,6 +2733,16 @@ public class AccountManagerService if (account == null) { throw new IllegalArgumentException("account is null"); } + + final int uid = Binder.getCallingUid(); + // Only allow system to start session + if (!isSystemUid(uid)) { + String msg = String.format( + "uid %s cannot start update credentials session.", + uid); + throw new SecurityException(msg); + } + int userId = UserHandle.getCallingUserId(); long identityToken = clearCallingIdentity(); try { diff --git a/services/core/java/com/android/server/media/MediaResourceMonitorService.java b/services/core/java/com/android/server/media/MediaResourceMonitorService.java index 2305d110d00a..50dd607e5a5a 100644 --- a/services/core/java/com/android/server/media/MediaResourceMonitorService.java +++ b/services/core/java/com/android/server/media/MediaResourceMonitorService.java @@ -32,7 +32,7 @@ import java.util.List; /** This class provides a system service that monitors media resource usage. */ public class MediaResourceMonitorService extends SystemService { - private static final String TAG = "MediaResourceMonitorService"; + private static final String TAG = "MediaResourceMonitor"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final String SERVICE_NAME = "media_resource_monitor"; diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index c10d9556bc16..afbaf00652a5 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2282,10 +2282,12 @@ final class WindowState implements WindowManagerPolicy.WindowState { void transformFromScreenToSurfaceSpace(Rect rect) { if (mHScale >= 0) { - rect.right = rect.left + (int)((rect.right - rect.left) / mHScale); + rect.left = (int) (rect.left / mHScale); + rect.right = (int) (rect.right / mHScale); } if (mVScale >= 0) { - rect.bottom = rect.top + (int)((rect.bottom - rect.top) / mVScale); + rect.top = (int) (rect.top / mVScale); + rect.bottom = (int) (rect.bottom / mVScale); } } diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index e27441e12a72..3f9d14d8e0cb 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -548,7 +548,8 @@ public class UsageStatsService extends SystemService implements final int userCount = mUserState.size(); for (int i = 0; i < userCount; i++) { final UserUsageStatsService service = mUserState.valueAt(i); - service.onTimeChanged(expectedSystemTime, actualSystemTime, resetBeginIdleTime); + service.onTimeChanged(expectedSystemTime, actualSystemTime, mScreenOnTime, + resetBeginIdleTime); } mRealTimeSnapshot = actualRealtime; mSystemTimeSnapshot = actualSystemTime; diff --git a/services/usage/java/com/android/server/usage/UserUsageStatsService.java b/services/usage/java/com/android/server/usage/UserUsageStatsService.java index 630367de40a9..28204b1cc941 100644 --- a/services/usage/java/com/android/server/usage/UserUsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UserUsageStatsService.java @@ -134,12 +134,12 @@ class UserUsageStatsService { stat.updateConfigurationStats(null, stat.lastTimeSaved); } + refreshAppIdleRollingWindow(currentTimeMillis, deviceUsageTime); + if (mDatabase.isNewUpdate()) { initializeDefaultsForApps(currentTimeMillis, deviceUsageTime, mDatabase.isFirstUpdate()); } - - refreshAppIdleRollingWindow(currentTimeMillis); } /** @@ -161,19 +161,24 @@ class UserUsageStatsService { for (IntervalStats stats : mCurrentStats) { stats.update(packageName, currentTimeMillis, Event.SYSTEM_INTERACTION); stats.updateBeginIdleTime(packageName, deviceUsageTime); - mStatsChanged = true; } + + mAppIdleRollingWindow.update(packageName, currentTimeMillis, + Event.SYSTEM_INTERACTION); + mAppIdleRollingWindow.updateBeginIdleTime(packageName, deviceUsageTime); + mStatsChanged = true; } } // Persist the new OTA-related access stats. persistActiveStats(); } - void onTimeChanged(long oldTime, long newTime, boolean resetBeginIdleTime) { + void onTimeChanged(long oldTime, long newTime, long deviceUsageTime, + boolean resetBeginIdleTime) { persistActiveStats(); mDatabase.onTimeChanged(newTime - oldTime); loadActiveStats(newTime, resetBeginIdleTime); - refreshAppIdleRollingWindow(newTime); + refreshAppIdleRollingWindow(newTime, deviceUsageTime); } void reportEvent(UsageEvents.Event event, long deviceUsageTime) { @@ -185,7 +190,7 @@ class UserUsageStatsService { if (event.mTimeStamp >= mDailyExpiryDate.getTimeInMillis()) { // Need to rollover - rolloverStats(event.mTimeStamp); + rolloverStats(event.mTimeStamp, deviceUsageTime); } final IntervalStats currentDailyStats = mCurrentStats[UsageStatsManager.INTERVAL_DAILY]; @@ -429,7 +434,7 @@ class UserUsageStatsService { } } - private void rolloverStats(final long currentTimeMillis) { + private void rolloverStats(final long currentTimeMillis, final long deviceUsageTime) { final long startTime = SystemClock.elapsedRealtime(); Slog.i(TAG, mLogPrefix + "Rolling over usage stats"); @@ -470,7 +475,7 @@ class UserUsageStatsService { } persistActiveStats(); - refreshAppIdleRollingWindow(currentTimeMillis); + refreshAppIdleRollingWindow(currentTimeMillis, deviceUsageTime); final long totalTime = SystemClock.elapsedRealtime() - startTime; Slog.i(TAG, mLogPrefix + "Rolling over usage stats complete. Took " + totalTime @@ -528,42 +533,28 @@ class UserUsageStatsService { mDailyExpiryDate.getTimeInMillis() + ")"); } - private static void mergePackageStats(IntervalStats dst, IntervalStats src) { + private static void mergePackageStats(IntervalStats dst, IntervalStats src, + final long deviceUsageTime) { dst.endTime = Math.max(dst.endTime, src.endTime); final int srcPackageCount = src.packageStats.size(); for (int i = 0; i < srcPackageCount; i++) { final String packageName = src.packageStats.keyAt(i); final UsageStats srcStats = src.packageStats.valueAt(i); - final UsageStats dstStats = dst.packageStats.get(packageName); + UsageStats dstStats = dst.packageStats.get(packageName); if (dstStats == null) { - dst.packageStats.put(packageName, new UsageStats(srcStats)); + dstStats = new UsageStats(srcStats); + dst.packageStats.put(packageName, dstStats); } else { dstStats.add(src.packageStats.valueAt(i)); } - } - } - /** - * Merges all the stats into the first element of the resulting list. - */ - private static final StatCombiner<IntervalStats> sPackageStatsMerger = - new StatCombiner<IntervalStats>() { - @Override - public void combine(IntervalStats stats, boolean mutable, - List<IntervalStats> accumulatedResult) { - IntervalStats accum; - if (accumulatedResult.isEmpty()) { - accum = new IntervalStats(); - accum.beginTime = stats.beginTime; - accumulatedResult.add(accum); - } else { - accum = accumulatedResult.get(0); + // App idle times can not begin in the future. This happens if we had a time change. + if (dstStats.mBeginIdleTime > deviceUsageTime) { + dstStats.mBeginIdleTime = deviceUsageTime; } - - mergePackageStats(accum, stats); } - }; + } /** * App idle operates on a rolling window of time. When we roll over time, we end up with a @@ -575,16 +566,31 @@ class UserUsageStatsService { * * @param currentTimeMillis */ - void refreshAppIdleRollingWindow(long currentTimeMillis) { + void refreshAppIdleRollingWindow(final long currentTimeMillis, final long deviceUsageTime) { // Start the rolling window for AppIdle requests. List<IntervalStats> stats = mDatabase.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, currentTimeMillis - (1000 * 60 * 60 * 24 * 2), currentTimeMillis, - sPackageStatsMerger); + new StatCombiner<IntervalStats>() { + @Override + public void combine(IntervalStats stats, boolean mutable, + List<IntervalStats> accumulatedResult) { + IntervalStats accum; + if (accumulatedResult.isEmpty()) { + accum = new IntervalStats(); + accum.beginTime = stats.beginTime; + accumulatedResult.add(accum); + } else { + accum = accumulatedResult.get(0); + } + + mergePackageStats(accum, stats, deviceUsageTime); + } + }); if (stats == null || stats.isEmpty()) { mAppIdleRollingWindow = new IntervalStats(); mergePackageStats(mAppIdleRollingWindow, - mCurrentStats[UsageStatsManager.INTERVAL_YEARLY]); + mCurrentStats[UsageStatsManager.INTERVAL_YEARLY], deviceUsageTime); } else { mAppIdleRollingWindow = stats.get(0); } |