Merge "Fix multi-dimen app transition delay tron event"
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index d5de660..d9c749a 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -457,8 +457,8 @@
}
/**
- * Return the extras Bundle object associated with this preference,
- * returning null if there is not currently one.
+ * Return the extras Bundle object associated with this preference, returning {@code null} if
+ * there is not currently one.
*/
public Bundle peekExtras() {
return mExtras;
@@ -996,7 +996,7 @@
* the persistent {@link SharedPreferences} storage by default or into
* {@link PreferenceDataStore} if assigned.
*
- * @param persistent Set true if it should store its value(s) into the {@link SharedPreferences}.
+ * @param persistent set {@code true} if it should store its value(s) into the storage.
*/
public void setPersistent(boolean persistent) {
mPersistent = persistent;
@@ -1057,7 +1057,7 @@
*
* @param preferenceScreen A {@link PreferenceScreen} whose hierarchy click
* listener should be called in the proper order (between other
- * processing). May be null.
+ * processing). May be {@code null}.
* @hide
*/
public void performClick(PreferenceScreen preferenceScreen) {
@@ -1124,9 +1124,9 @@
* {@link SharedPreferences}, this is intended behavior to improve
* performance.
*
- * @return The {@link SharedPreferences} where this Preference reads its value(s), or null if it
- * isn't attached to a Preference hierarchy or if {@link PreferenceDataStore} is used
- * instead.
+ * @return the {@link SharedPreferences} where this Preference reads its value(s). If
+ * this preference isn't attached to a Preference hierarchy or if
+ * a {@link PreferenceDataStore} has been set, this method returns {@code null}.
* @see #getEditor()
* @see #setPreferenceDataStore(PreferenceDataStore)
*/
@@ -1151,9 +1151,9 @@
* not show up in the SharedPreferences, this is intended behavior to
* improve performance.
*
- * @return A {@link SharedPreferences.Editor} where this preference saves its value(s), or null
- * if it isn't attached to a Preference hierarchy or if {@link PreferenceDataStore} is
- * used instead.
+ * @return a {@link SharedPreferences.Editor} where this preference saves its value(s). If
+ * this preference isn't attached to a Preference hierarchy or if
+ * a {@link PreferenceDataStore} has been set, this method returns {@code null}.
* @see #shouldCommit()
* @see #getSharedPreferences()
* @see #setPreferenceDataStore(PreferenceDataStore)
@@ -1171,7 +1171,7 @@
* {@link #getEditor()}. This may return false in situations where batch
* committing is being done (by the manager) to improve performance.
*
- * <p>If this preference is using {@link PreferenceDataStore} this value should be irrelevant.
+ * <p>If this preference is using {@link PreferenceDataStore} this value is irrelevant.
*
* @return Whether the Preference should commit its saved value(s).
* @see #getEditor()
@@ -1275,10 +1275,10 @@
}
/**
- * Assigns a {@link PreferenceGroup} as the parent of this Preference. Set null to remove
- * the current parent.
+ * Assigns a {@link PreferenceGroup} as the parent of this Preference. Set {@code null} to
+ * remove the current parent.
*
- * @param parentGroup Parent preference group of this Preference or null if none.
+ * @param parentGroup Parent preference group of this Preference or {@code null} if none.
*/
void assignParent(@Nullable PreferenceGroup parentGroup) {
mParentGroup = parentGroup;
@@ -1447,10 +1447,10 @@
}
/**
- * Returns the {@link PreferenceGroup} which is this Preference assigned to or null if this
- * preference is not assigned to any group or is a root Preference.
+ * Returns the {@link PreferenceGroup} which is this Preference assigned to or {@code null} if
+ * this preference is not assigned to any group or is a root Preference.
*
- * @return The parent PreferenceGroup or null if not attached to any.
+ * @return the parent PreferenceGroup or {@code null} if not attached to any
*/
@Nullable
public PreferenceGroup getParent() {
@@ -1505,7 +1505,7 @@
* if {@link #shouldPersist()} is true).
*
* <p>In case of using {@link PreferenceDataStore}, the <var>restorePersistedValue</var> is
- * always false. But the default value (if provided) is set.
+ * always {@code true}. But the default value (if provided) is set.
*
* <p>This may not always be called. One example is if it should not persist
* but there is no default value given.
@@ -1928,9 +1928,9 @@
* state. This state should only contain information that is not persistent
* or can be reconstructed later.
*
- * @return A Parcelable object containing the current dynamic state of
- * this Preference, or null if there is nothing interesting to save.
- * The default implementation returns null.
+ * @return A Parcelable object containing the current dynamic state of this Preference, or
+ * {@code null} if there is nothing interesting to save. The default implementation
+ * returns {@code null}.
* @see #onRestoreInstanceState
* @see #saveHierarchyState
*/
@@ -1976,9 +1976,9 @@
}
/**
- * Hook allowing a Preference to re-apply a representation of its internal
- * state that had previously been generated by {@link #onSaveInstanceState}.
- * This function will never be called with a null state.
+ * Hook allowing a Preference to re-apply a representation of its internal state that had
+ * previously been generated by {@link #onSaveInstanceState}. This function will never be called
+ * with a {@code null} state.
*
* @param state The saved state that had previously been returned by
* {@link #onSaveInstanceState}.
diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java
index 14b748a..ea32dfd 100644
--- a/core/java/android/preference/PreferenceManager.java
+++ b/core/java/android/preference/PreferenceManager.java
@@ -93,8 +93,8 @@
private SharedPreferences mSharedPreferences;
/**
- * Data store to be used by the Preferences or null if {@link android.content.SharedPreferences}
- * should be used.
+ * Data store to be used by the Preferences or {@code null} if
+ * {@link android.content.SharedPreferences} should be used.
*/
@Nullable
private PreferenceDataStore mPreferenceDataStore;
@@ -484,11 +484,16 @@
/**
* Gets a {@link SharedPreferences} instance that preferences managed by this will use.
*
- * @return A {@link SharedPreferences} instance pointing to the file that contains the values of
- * preferences that are managed by this or null if {@link PreferenceDataStore} is used instead.
+ * @return a {@link SharedPreferences} instance pointing to the file that contains the values of
+ * preferences that are managed by this PreferenceManager. If a
+ * {@link PreferenceDataStore} has been set, this method returns {@code null}.
*/
public SharedPreferences getSharedPreferences() {
- if (mSharedPreferences == null && getPreferenceDataStore() == null) {
+ if (mPreferenceDataStore != null) {
+ return null;
+ }
+
+ if (mSharedPreferences == null) {
final Context storageContext;
switch (mStorage) {
case STORAGE_DEVICE_PROTECTED:
@@ -564,8 +569,8 @@
/**
* Finds a {@link Preference} based on its key.
*
- * @param key The key of the preference to retrieve.
- * @return The {@link Preference} with the key, or null.
+ * @param key the key of the preference to retrieve
+ * @return the {@link Preference} with the key, or {@code null}
* @see PreferenceGroup#findPreference(CharSequence)
*/
@Nullable
@@ -659,11 +664,11 @@
/**
* Returns an editor to use when modifying the shared preferences.
- * <p>
- * Do NOT commit unless {@link #shouldCommit()} returns true.
*
- * @return An editor to use to write to shared preferences or null if
- * {@link PreferenceDataStore} is used instead.
+ * <p>Do NOT commit unless {@link #shouldCommit()} returns true.
+ *
+ * @return an editor to use to write to shared preferences. If a {@link PreferenceDataStore}
+ * has been set, this method returns {@code null}.
* @see #shouldCommit()
*/
SharedPreferences.Editor getEditor() {
@@ -687,6 +692,8 @@
* {@link #getEditor()}. This will return false in cases where the writes
* should be batched, for example when inflating preferences from XML.
*
+ * <p>If preferences are using {@link PreferenceDataStore} this value is irrelevant.
+ *
* @return Whether the client should commit.
*/
boolean shouldCommit() {
@@ -711,8 +718,8 @@
* Returns the activity that shows the preferences. This is useful for doing
* managed queries, but in most cases the use of {@link #getContext()} is
* preferred.
- * <p>
- * This will return null if this class was instantiated with a Context
+ *
+ * <p>This will return {@code null} if this class was instantiated with a Context
* instead of Activity. For example, when setting the default values.
*
* @return The activity that shows the preferences.
diff --git a/packages/Shell/res/drawable/ic_bug_report_black_24dp.xml b/packages/Shell/res/drawable/ic_bug_report_black_24dp.xml
new file mode 100644
index 0000000..a102cee
--- /dev/null
+++ b/packages/Shell/res/drawable/ic_bug_report_black_24dp.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:pathData="M20,8h-2.81c-0.45,-0.78 -1.07,-1.45 -1.82,-1.96L17,4.41 15.59,3l-2.17,2.17C12.96,5.06 12.49,5 12,5c-0.49,0 -0.96,0.06 -1.41,0.17L8.41,3 7,4.41l1.62,1.63C7.88,6.55 7.26,7.22 6.81,8L4,8v2h2.09c-0.05,0.33 -0.09,0.66 -0.09,1v1L4,12v2h2v1c0,0.34 0.04,0.67 0.09,1L4,16v2h2.81c1.04,1.79 2.97,3 5.19,3s4.15,-1.21 5.19,-3L20,18v-2h-2.09c0.05,-0.33 0.09,-0.66 0.09,-1v-1h2v-2h-2v-1c0,-0.34 -0.04,-0.67 -0.09,-1L20,10L20,8zM14,16h-4v-2h4v2zM14,12h-4v-2h4v2z"
+ android:fillColor="#000000"/>
+</vector>
diff --git a/packages/Shell/res/values/strings.xml b/packages/Shell/res/values/strings.xml
index 2a5703a..1c49a55d 100644
--- a/packages/Shell/res/values/strings.xml
+++ b/packages/Shell/res/values/strings.xml
@@ -4,9 +4,9 @@
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.
@@ -16,6 +16,9 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_label">Shell</string>
+ <!-- Title of notification channel for bug report related notifications. [CHAR LIMIT=50] -->
+ <string name="bugreport_notification_channel">Bug reports</string>
+
<!-- Title of notification indicating a bugreport is being generated. [CHAR LIMIT=50] -->
<string name="bugreport_in_progress_title">Bug report <xliff:g id="id">#%d</xliff:g> is being generated</string>
<!-- Title of notification indicating a bugreport has been successfully captured. [CHAR LIMIT=50] -->
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 1df626f..bf5e6f8 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -57,6 +57,7 @@
import android.app.AlertDialog;
import android.app.Notification;
import android.app.Notification.Action;
+import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
@@ -64,6 +65,7 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.Uri;
@@ -196,6 +198,8 @@
*/
private static final String SCREENSHOT_DIR = "bugreports";
+ private static final String NOTIFICATION_CHANNEL_ID = "bugreports";
+
/** Managed dumpstate processes (keyed by id) */
private final SparseArray<DumpstateListener> mProcesses = new SparseArray<>();
@@ -240,6 +244,12 @@
final Configuration conf = mContext.getResources().getConfiguration();
mIsWatch = (conf.uiMode & Configuration.UI_MODE_TYPE_MASK) ==
Configuration.UI_MODE_TYPE_WATCH;
+ NotificationManager nm = NotificationManager.from(mContext);
+ nm.createNotificationChannel(
+ new NotificationChannel(NOTIFICATION_CHANNEL_ID,
+ mContext.getString(R.string.bugreport_notification_channel),
+ isTv(this) ? NotificationManager.IMPORTANCE_DEFAULT
+ : NotificationManager.IMPORTANCE_LOW));
}
@Override
@@ -1008,13 +1018,16 @@
sNotificationBundle.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
context.getString(com.android.internal.R.string.android_system_label));
}
- return new Notification.Builder(context)
+ return new Notification.Builder(context, NOTIFICATION_CHANNEL_ID)
.addExtras(sNotificationBundle)
.setCategory(Notification.CATEGORY_SYSTEM)
- .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
+ .setSmallIcon(
+ isTv(context) ? R.drawable.ic_bug_report_black_24dp
+ : com.android.internal.R.drawable.stat_sys_adb)
.setLocalOnly(true)
.setColor(context.getColor(
- com.android.internal.R.color.system_notification_accent_color));
+ com.android.internal.R.color.system_notification_accent_color))
+ .extend(new Notification.TvExtender());
}
/**
@@ -1333,6 +1346,10 @@
return false;
}
+ private static boolean isTv(Context context) {
+ return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+ }
+
/**
* Checks whether a character is valid on bugreport names.
*/
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index 6424a0a..4250962 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -46,6 +46,7 @@
import com.android.systemui.util.wakelock.WakeLockFake;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -175,6 +176,7 @@
assertFalse(mWakeLock.isHeld());
}
+ @Ignore("Flaky")
@Test
public void transientIndication_releasesWakeLock_afterHidingDelayed() throws Throwable {
mInstrumentation.runOnMainSync(() -> {
diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java
index f7d3343..c9863c5 100644
--- a/services/core/java/com/android/server/wm/WindowSurfaceController.java
+++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java
@@ -566,7 +566,10 @@
pw.print(" rect=("); pw.print(mSurfaceX);
pw.print(","); pw.print(mSurfaceY);
pw.print(") "); pw.print(mSurfaceW);
- pw.print(" x "); pw.println(mSurfaceH);
+ pw.print(" x "); pw.print(mSurfaceH);
+ pw.print(" transform=("); pw.print(mLastDsdx); pw.print(", ");
+ pw.print(mLastDtdx); pw.print(", "); pw.print(mLastDsdy);
+ pw.print(", "); pw.print(mLastDtdy); pw.println(")");
}
@Override