Merge "Uses ParceledListSlice to allow larger number of datasets." into oc-mr1-dev
diff --git a/core/java/com/android/internal/colorextraction/ColorExtractor.java b/core/java/com/android/internal/colorextraction/ColorExtractor.java
index 477285e63..727412b 100644
--- a/core/java/com/android/internal/colorextraction/ColorExtractor.java
+++ b/core/java/com/android/internal/colorextraction/ColorExtractor.java
@@ -45,12 +45,12 @@
private static final String TAG = "ColorExtractor";
- private final SparseArray<GradientColors[]> mGradientColors;
+ protected final SparseArray<GradientColors[]> mGradientColors;
private final ArrayList<WeakReference<OnColorsChangedListener>> mOnColorsChangedListeners;
private final Context mContext;
private final ExtractionType mExtractionType;
- private WallpaperColors mSystemColors;
- private WallpaperColors mLockColors;
+ protected WallpaperColors mSystemColors;
+ protected WallpaperColors mLockColors;
public ColorExtractor(Context context) {
this(context, new Tonal(context));
diff --git a/core/java/com/android/internal/util/AsyncChannel.java b/core/java/com/android/internal/util/AsyncChannel.java
index 6fbfff8..e760f25 100644
--- a/core/java/com/android/internal/util/AsyncChannel.java
+++ b/core/java/com/android/internal/util/AsyncChannel.java
@@ -402,7 +402,6 @@
// Initialize destination fields
mDstMessenger = dstMessenger;
- linkToDeathMonitor();
if (DBG) log("connected srcHandler to the dstMessenger X");
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index d175422..aa98bace 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -545,6 +545,7 @@
<protected-broadcast android:name="android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED" />
<protected-broadcast android:name="android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED" />
<protected-broadcast android:name="android.media.tv.action.CHANNEL_BROWSABLE_REQUESTED" />
+ <protected-broadcast android:name="com.android.server.InputMethodManagerService.SHOW_INPUT_METHOD_PICKER" />
<!-- ====================================================================== -->
<!-- RUNTIME PERMISSIONS -->
diff --git a/packages/SystemUI/res/layout/zen_mode_condition.xml b/packages/SystemUI/res/layout/zen_mode_condition.xml
index 2b4a0f5..ab52465 100644
--- a/packages/SystemUI/res/layout/zen_mode_condition.xml
+++ b/packages/SystemUI/res/layout/zen_mode_condition.xml
@@ -27,6 +27,8 @@
android:id="@android:id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:minHeight="48dp"
+ android:gravity="center_vertical"
android:layout_centerVertical="true"
android:orientation="vertical"
android:layout_toEndOf="@android:id/checkbox"
@@ -79,4 +81,4 @@
android:tint="?android:attr/textColorPrimary"
android:src="@drawable/ic_qs_plus" />
-</RelativeLayout>
\ No newline at end of file
+</RelativeLayout>
diff --git a/packages/SystemUI/res/layout/zen_mode_panel.xml b/packages/SystemUI/res/layout/zen_mode_panel.xml
index 4261641..5516983 100644
--- a/packages/SystemUI/res/layout/zen_mode_panel.xml
+++ b/packages/SystemUI/res/layout/zen_mode_panel.xml
@@ -93,7 +93,7 @@
</RelativeLayout>
- <LinearLayout
+ <com.android.systemui.volume.ZenRadioLayout
android:id="@+id/zen_conditions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -111,7 +111,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"/>
- </LinearLayout>
+ </com.android.systemui.volume.ZenRadioLayout>
<TextView
android:id="@+id/zen_alarm_warning"
diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
index 61cbc98..9ba7be8 100644
--- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
+++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
@@ -31,11 +31,16 @@
import com.android.internal.colorextraction.ColorExtractor;
import com.android.internal.colorextraction.types.ExtractionType;
import com.android.internal.colorextraction.types.Tonal;
+import com.android.systemui.Dumpable;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.Arrays;
/**
* ColorExtractor aware of wallpaper visibility
*/
-public class SysuiColorExtractor extends ColorExtractor {
+public class SysuiColorExtractor extends ColorExtractor implements Dumpable {
private static final String TAG = "SysuiColorExtractor";
private boolean mWallpaperVisible;
// Colors to return when the wallpaper isn't visible
@@ -154,4 +159,20 @@
}
}
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("SysuiColorExtractor:");
+
+ pw.println(" Current wallpaper colors:");
+ pw.println(" system: " + mSystemColors);
+ pw.println(" lock: " + mLockColors);
+
+ GradientColors[] system = mGradientColors.get(WallpaperManager.FLAG_SYSTEM);
+ GradientColors[] lock = mGradientColors.get(WallpaperManager.FLAG_LOCK);
+ pw.println(" Gradients:");
+ pw.println(" system: " + Arrays.toString(system));
+ pw.println(" lock: " + Arrays.toString(lock));
+ pw.println(" Default scrim: " + mWpHiddenColors);
+
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java b/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
index 1dc37cd..8847452 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeUi.java
@@ -100,7 +100,6 @@
private boolean shouldAnimateWakeup(DozeMachine.State state) {
switch (state) {
- case DOZE_AOD:
case DOZE_REQUEST_PULSE:
case DOZE_PULSING:
case DOZE_PULSE_DONE:
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java
index 3f39dfe..b6fce44 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java
@@ -16,6 +16,8 @@
package com.android.systemui.keyguard;
+import android.os.Trace;
+
import com.android.systemui.Dumpable;
import java.io.FileDescriptor;
@@ -38,22 +40,22 @@
}
public void dispatchScreenTurningOn() {
- mScreenState = SCREEN_TURNING_ON;
+ setScreenState(SCREEN_TURNING_ON);
dispatch(Observer::onScreenTurningOn);
}
public void dispatchScreenTurnedOn() {
- mScreenState = SCREEN_ON;
+ setScreenState(SCREEN_ON);
dispatch(Observer::onScreenTurnedOn);
}
public void dispatchScreenTurningOff() {
- mScreenState = SCREEN_TURNING_OFF;
+ setScreenState(SCREEN_TURNING_OFF);
dispatch(Observer::onScreenTurningOff);
}
public void dispatchScreenTurnedOff() {
- mScreenState = SCREEN_OFF;
+ setScreenState(SCREEN_OFF);
dispatch(Observer::onScreenTurnedOff);
}
@@ -63,6 +65,11 @@
pw.println(" mScreenState=" + mScreenState);
}
+ private void setScreenState(int screenState) {
+ mScreenState = screenState;
+ Trace.traceCounter(Trace.TRACE_TAG_APP, "screenState", screenState);
+ }
+
public interface Observer {
default void onScreenTurningOn() {}
default void onScreenTurnedOn() {}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
index 578e6fb..951c0ea 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java
@@ -16,6 +16,8 @@
package com.android.systemui.keyguard;
+import android.os.Trace;
+
import com.android.systemui.Dumpable;
import java.io.FileDescriptor;
@@ -39,22 +41,22 @@
}
public void dispatchStartedWakingUp() {
- mWakefulness = WAKEFULNESS_WAKING;
+ setWakefulness(WAKEFULNESS_WAKING);
dispatch(Observer::onStartedWakingUp);
}
public void dispatchFinishedWakingUp() {
- mWakefulness = WAKEFULNESS_AWAKE;
+ setWakefulness(WAKEFULNESS_AWAKE);
dispatch(Observer::onFinishedWakingUp);
}
public void dispatchStartedGoingToSleep() {
- mWakefulness = WAKEFULNESS_GOING_TO_SLEEP;
+ setWakefulness(WAKEFULNESS_GOING_TO_SLEEP);
dispatch(Observer::onStartedGoingToSleep);
}
public void dispatchFinishedGoingToSleep() {
- mWakefulness = WAKEFULNESS_ASLEEP;
+ setWakefulness(WAKEFULNESS_ASLEEP);
dispatch(Observer::onFinishedGoingToSleep);
}
@@ -64,6 +66,11 @@
pw.println(" mWakefulness=" + mWakefulness);
}
+ private void setWakefulness(int wakefulness) {
+ mWakefulness = wakefulness;
+ Trace.traceCounter(Trace.TRACE_TAG_APP, "wakefulness", wakefulness);
+ }
+
public interface Observer {
default void onStartedWakingUp() {}
default void onFinishedWakingUp() {}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
index 14afbfa..c691498 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
@@ -269,7 +269,7 @@
item.icon = R.drawable.ic_qs_bluetooth_on;
item.line1 = device.getName();
item.tag = device;
- int state = mController.getMaxConnectionState(device);
+ int state = device.getMaxConnectionState();
if (state == BluetoothProfile.STATE_CONNECTED) {
item.icon = R.drawable.ic_qs_bluetooth_connected;
int batteryLevel = device.getBatteryLevel();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 4ffc15f..04be357 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -231,6 +231,7 @@
private int mAmbientIndicationBottomPadding;
private boolean mIsFullWidth;
private float mDarkAmount;
+ private float mDarkAmountTarget;
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mNoVisibleNotifications = true;
private ValueAnimator mDarkAnimator;
@@ -2578,8 +2579,13 @@
return;
}
if (mDarkAnimator != null && mDarkAnimator.isRunning()) {
- mDarkAnimator.cancel();
+ if (animate && mDarkAmountTarget == darkAmount) {
+ return;
+ } else {
+ mDarkAnimator.cancel();
+ }
}
+ mDarkAmountTarget = darkAmount;
if (animate) {
mDarkAnimator = ObjectAnimator.ofFloat(this, SET_DARK_AMOUNT_PROPERTY, darkAmount);
mDarkAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 7273942..9c591ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -3520,6 +3520,14 @@
pw.print (" ");
mStackScroller.dump(fd, pw, args);
}
+ pw.println(" Theme:");
+ if (mOverlayManager == null) {
+ pw.println(" overlay manager not initialized!");
+ } else {
+ pw.println(" dark overlay on: " + isUsingDarkTheme());
+ }
+ final boolean lightWpTheme = mContext.getThemeResId() == R.style.Theme_SystemUI_Light;
+ pw.println(" light wallpaper theme: " + lightWpTheme);
DozeLog.dump(pw);
@@ -4623,6 +4631,7 @@
}
private void updateDozingState() {
+ Trace.traceCounter(Trace.TRACE_TAG_APP, "dozing", mDozing ? 1 : 0);
Trace.beginSection("StatusBar#updateDozingState");
boolean animate = !mDozing && mDozeServiceHost.shouldAnimateWakeup();
mNotificationPanel.setDozing(mDozing, animate);
@@ -5505,6 +5514,11 @@
@Override
public void setAnimateWakeup(boolean animateWakeup) {
+ if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_AWAKE
+ || mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_WAKING) {
+ // Too late to change the wakeup animation.
+ return;
+ }
mAnimateWakeup = animateWakeup;
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenRadioLayout.java b/packages/SystemUI/src/com/android/systemui/volume/ZenRadioLayout.java
new file mode 100644
index 0000000..5dbcd8a
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenRadioLayout.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017 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.systemui.volume;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+
+/**
+ * Specialized layout for zen mode that allows the radio buttons to reside within
+ * a RadioGroup, but also makes sure that all the heights off the radio buttons align
+ * with the corresponding content in the second child of this view.
+ */
+public class ZenRadioLayout extends LinearLayout {
+
+ public ZenRadioLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ /**
+ * Run 2 measurement passes, 1 that figures out the size of the content, and another
+ * that sets the size of the radio buttons to the heights of the corresponding content.
+ */
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ ViewGroup radioGroup = (ViewGroup) getChildAt(0);
+ ViewGroup radioContent = (ViewGroup) getChildAt(1);
+ int size = radioGroup.getChildCount();
+ if (size != radioContent.getChildCount()) {
+ throw new IllegalStateException("Expected matching children");
+ }
+ boolean hasChanges = false;
+ for (int i = 0; i < size; i++) {
+ View radio = radioGroup.getChildAt(i);
+ View content = radioContent.getChildAt(i);
+ if (radio.getLayoutParams().height != content.getMeasuredHeight()) {
+ hasChanges = true;
+ radio.getLayoutParams().height = content.getMeasuredHeight();
+ }
+ }
+ // Measure again if any heights changed.
+ if (hasChanges) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+ }
+}
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index a8e2f32..ce062aa 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -50,6 +50,7 @@
import org.xmlpull.v1.XmlSerializer;
import android.annotation.BinderThread;
+import android.annotation.ColorInt;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -231,6 +232,13 @@
int WIRED_AFFORDANCE = 1;
}
+ /**
+ * A protected broadcast intent action for internal use for {@link PendingIntent} in
+ * the notification.
+ */
+ private static final String ACTION_SHOW_INPUT_METHOD_PICKER =
+ "com.android.server.InputMethodManagerService.SHOW_INPUT_METHOD_PICKER";
+
final Context mContext;
final Resources mRes;
final Handler mHandler;
@@ -836,6 +844,16 @@
}
} else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
onActionLocaleChanged();
+ } else if (ACTION_SHOW_INPUT_METHOD_PICKER.equals(action)) {
+ // ACTION_SHOW_INPUT_METHOD_PICKER action is a protected-broadcast and it is
+ // guaranteed to be send only from the system, so that there is no need for extra
+ // security check such as
+ // {@link #canShowInputMethodPickerLocked(IInputMethodClient)}.
+ mHandler.obtainMessage(
+ MSG_SHOW_IM_SUBTYPE_PICKER,
+ InputMethodManager.SHOW_IM_PICKER_MODE_INCLUDE_AUXILIARY_SUBTYPES,
+ 0 /* arg2 */)
+ .sendToTarget();
} else {
Slog.w(TAG, "Unexpected intent " + intent);
}
@@ -1285,6 +1303,8 @@
Bundle extras = new Bundle();
extras.putBoolean(Notification.EXTRA_ALLOW_DURING_SETUP, true);
+ @ColorInt final int accentColor = mContext.getColor(
+ com.android.internal.R.color.system_notification_accent_color);
mImeSwitcherNotification =
new Notification.Builder(mContext, SystemNotificationChannels.VIRTUAL_KEYBOARD)
.setSmallIcon(com.android.internal.R.drawable.ic_notification_ime_default)
@@ -1292,9 +1312,10 @@
.setOngoing(true)
.addExtras(extras)
.setCategory(Notification.CATEGORY_SYSTEM)
- .setColor(com.android.internal.R.color.system_notification_accent_color);
+ .setColor(accentColor);
- Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER);
+ Intent intent = new Intent(ACTION_SHOW_INPUT_METHOD_PICKER)
+ .setPackage(mContext.getPackageName());
mImeSwitchPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
mShowOngoingImeSwitcherForPhones = false;
@@ -1445,6 +1466,7 @@
broadcastFilter.addAction(Intent.ACTION_USER_REMOVED);
broadcastFilter.addAction(Intent.ACTION_SETTING_RESTORED);
broadcastFilter.addAction(Intent.ACTION_LOCALE_CHANGED);
+ broadcastFilter.addAction(ACTION_SHOW_INPUT_METHOD_PICKER);
mContext.registerReceiver(new ImmsBroadcastReceiver(), broadcastFilter);
buildInputMethodListLocked(true /* resetDefaultEnabledIme */);
diff --git a/wifi/java/android/net/wifi/IRttManager.aidl b/wifi/java/android/net/wifi/IRttManager.aidl
index 90f66c4..3831809 100644
--- a/wifi/java/android/net/wifi/IRttManager.aidl
+++ b/wifi/java/android/net/wifi/IRttManager.aidl
@@ -23,6 +23,6 @@
*/
interface IRttManager
{
- Messenger getMessenger();
+ Messenger getMessenger(in IBinder binder, out int[] key);
RttManager.RttCapabilities getRttCapabilities();
}
diff --git a/wifi/java/android/net/wifi/RttManager.java b/wifi/java/android/net/wifi/RttManager.java
index a4b3bf2a..ac5df05 100644
--- a/wifi/java/android/net/wifi/RttManager.java
+++ b/wifi/java/android/net/wifi/RttManager.java
@@ -6,6 +6,7 @@
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.content.Context;
+import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -1187,6 +1188,8 @@
CMD_OP_ENALBE_RESPONDER_SUCCEEDED = BASE + 7;
public static final int
CMD_OP_ENALBE_RESPONDER_FAILED = BASE + 8;
+ /** @hide */
+ public static final int CMD_OP_REG_BINDER = BASE + 9;
private static final int INVALID_KEY = 0;
@@ -1215,9 +1218,10 @@
mContext = context;
mService = service;
Messenger messenger = null;
+ int[] key = new int[1];
try {
Log.d(TAG, "Get the messenger from " + mService);
- messenger = mService.getMessenger();
+ messenger = mService.getMessenger(new Binder(), key);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1233,6 +1237,7 @@
// We cannot use fullyConnectSync because it sends the FULL_CONNECTION message
// synchronously, which causes RttService to receive the wrong replyTo value.
mAsyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION);
+ mAsyncChannel.sendMessage(CMD_OP_REG_BINDER, key[0]);
}
private void validateChannel() {