diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-06-18 23:34:45 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-06-18 23:34:45 +0000 |
commit | 2d3cc4d360c2ae482ce397c69a5361e946a4aa22 (patch) | |
tree | 9185761d0a1f0ef385583ec8558b9982a4d72d95 | |
parent | 958fbb9c86a1bad8f11a7bc5b6198a73d571c472 (diff) | |
parent | db0da5637abb701eb290e41a369b5b696a94f225 (diff) | |
download | base-2d3cc4d360c2ae482ce397c69a5361e946a4aa22.tar.gz |
Merge cherrypicks of [4368877, 4369031, 4369032, 4369033, 4369034, 4368878, 4369035, 4369036, 4369008] into pi-release
Change-Id: I961d7c7e4922defecafaa3976c69491a2b20c71e
4 files changed, 61 insertions, 30 deletions
diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java index 6df76fa2e09a..e6f948f2d969 100644 --- a/core/java/android/widget/AppSecurityPermissions.java +++ b/core/java/android/widget/AppSecurityPermissions.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; +import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PermissionGroupInfo; @@ -590,7 +591,8 @@ public class AppSecurityPermissions { private void addPermToList(List<MyPermissionInfo> permList, MyPermissionInfo pInfo) { if (pInfo.mLabel == null) { - pInfo.mLabel = pInfo.loadLabel(mPm); + pInfo.mLabel = pInfo.loadSafeLabel(mPm, 20000, PackageItemInfo.SAFE_LABEL_FLAG_TRIM + | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE); } int idx = Collections.binarySearch(permList, pInfo, mPermComparator); if(localLOGV) Log.i(TAG, "idx="+idx+", list.size="+permList.size()); @@ -611,7 +613,9 @@ public class AppSecurityPermissions { } MyPermissionGroupInfo group = mPermGroups.get(pInfo.group); if (group != null) { - pInfo.mLabel = pInfo.loadLabel(mPm); + pInfo.mLabel = pInfo.loadSafeLabel(mPm, 20000, + PackageItemInfo.SAFE_LABEL_FLAG_TRIM + | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE); addPermToList(group.mAllPermissions, pInfo); if (pInfo.mNew) { addPermToList(group.mNewPermissions, pInfo); @@ -622,14 +626,18 @@ public class AppSecurityPermissions { for (MyPermissionGroupInfo pgrp : mPermGroups.values()) { if (pgrp.labelRes != 0 || pgrp.nonLocalizedLabel != null) { - pgrp.mLabel = pgrp.loadLabel(mPm); + pgrp.mLabel = pgrp.loadSafeLabel(mPm, 20000, PackageItemInfo.SAFE_LABEL_FLAG_TRIM + | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE); } else { ApplicationInfo app; try { app = mPm.getApplicationInfo(pgrp.packageName, 0); - pgrp.mLabel = app.loadLabel(mPm); + pgrp.mLabel = app.loadSafeLabel(mPm, 20000, PackageItemInfo.SAFE_LABEL_FLAG_TRIM + | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE); } catch (NameNotFoundException e) { - pgrp.mLabel = pgrp.loadLabel(mPm); + pgrp.mLabel = pgrp.loadSafeLabel(mPm, 20000, + PackageItemInfo.SAFE_LABEL_FLAG_TRIM + | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE); } } mPermGroupsList.add(pgrp); diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java index 54358e355444..e397ed90c2e2 100644 --- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java @@ -57,6 +57,8 @@ import android.view.View; import com.android.internal.R; import com.android.internal.util.VirtualRefBasePtr; +import dalvik.annotation.optimization.FastNative; + import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -64,7 +66,6 @@ import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; -import dalvik.annotation.optimization.FastNative; /** * This class animates properties of a {@link android.graphics.drawable.VectorDrawable} with @@ -167,7 +168,7 @@ import dalvik.annotation.optimization.FastNative; * </p> * Below is an example of a VectorDrawable defined in vectordrawable.xml. This VectorDrawable is * referred to by its file name (not including file suffix) in the - * <a href="AVDExample">AnimatedVectorDrawable XML example</a>. + * <a href="#AVDExample">AnimatedVectorDrawable XML example</a>. * <pre> * <vector xmlns:android="http://schemas.android.com/apk/res/android" * android:height="64dp" diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index db5f7ed7cc8a..13de652350dc 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -236,7 +236,6 @@ public class AudioService extends IAudioService.Stub private static final int MSG_PERSIST_RINGER_MODE = 3; private static final int MSG_AUDIO_SERVER_DIED = 4; private static final int MSG_PLAY_SOUND_EFFECT = 5; - private static final int MSG_BTA2DP_DOCK_TIMEOUT = 6; private static final int MSG_LOAD_SOUND_EFFECTS = 7; private static final int MSG_SET_FORCE_USE = 8; private static final int MSG_BT_HEADSET_CNCT_FAILED = 9; @@ -268,6 +267,7 @@ public class AudioService extends IAudioService.Stub private static final int MSG_A2DP_DEVICE_CONFIG_CHANGE = 103; private static final int MSG_DISABLE_AUDIO_FOR_UID = 104; private static final int MSG_SET_HEARING_AID_CONNECTION_STATE = 105; + private static final int MSG_BTA2DP_DOCK_TIMEOUT = 106; // end of messages handled under wakelock private static final int BTA2DP_DOCK_TIMEOUT_MILLIS = 8000; @@ -4512,13 +4512,21 @@ public class AudioService extends IAudioService.Stub } synchronized (mLastDeviceConnectMsgTime) { long time = SystemClock.uptimeMillis() + delay; - handler.sendMessageAtTime(handler.obtainMessage(msg, arg1, arg2, obj), time); - if (msg == MSG_SET_WIRED_DEVICE_CONNECTION_STATE || - msg == MSG_SET_A2DP_SRC_CONNECTION_STATE || - msg == MSG_SET_A2DP_SINK_CONNECTION_STATE || - msg == MSG_SET_HEARING_AID_CONNECTION_STATE) { + + if (msg == MSG_SET_A2DP_SRC_CONNECTION_STATE || + msg == MSG_SET_A2DP_SINK_CONNECTION_STATE || + msg == MSG_SET_HEARING_AID_CONNECTION_STATE || + msg == MSG_SET_WIRED_DEVICE_CONNECTION_STATE || + msg == MSG_A2DP_DEVICE_CONFIG_CHANGE || + msg == MSG_BTA2DP_DOCK_TIMEOUT) { + if (mLastDeviceConnectMsgTime >= time) { + // add a little delay to make sure messages are ordered as expected + time = mLastDeviceConnectMsgTime + 30; + } mLastDeviceConnectMsgTime = time; } + + handler.sendMessageAtTime(handler.obtainMessage(msg, arg1, arg2, obj), time); } } @@ -4680,6 +4688,13 @@ public class AudioService extends IAudioService.Stub } else { delay = 0; } + + if (DEBUG_DEVICES) { + Log.d(TAG, "setBluetoothA2dpDeviceConnectionStateInt device: " + device + + " state: " + state + " delay(ms): " + delay + + " suppressNoisyIntent: " + suppressNoisyIntent); + } + queueMsgUnderWakeLock(mAudioHandler, (profile == BluetoothProfile.A2DP ? MSG_SET_A2DP_SINK_CONNECTION_STATE : MSG_SET_A2DP_SRC_CONNECTION_STATE), @@ -5588,6 +5603,7 @@ public class AudioService extends IAudioService.Stub synchronized (mConnectedDevices) { makeA2dpDeviceUnavailableNow( (String) msg.obj ); } + mAudioEventWakeLock.release(); break; case MSG_SET_FORCE_USE: @@ -5818,6 +5834,9 @@ public class AudioService extends IAudioService.Stub // must be called synchronized on mConnectedDevices private void makeA2dpDeviceUnavailableNow(String address) { + if (address == null) { + return; + } synchronized (mA2dpAvrcpLock) { mAvrcpAbsVolSupported = false; } @@ -5827,6 +5846,9 @@ public class AudioService extends IAudioService.Stub makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address)); // Remove A2DP routes as well setCurrentAudioRouteName(null); + if (mDockAddress == address) { + mDockAddress = null; + } } // must be called synchronized on mConnectedDevices @@ -5838,9 +5860,12 @@ public class AudioService extends IAudioService.Stub mConnectedDevices.remove( makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address)); // send the delayed message to make the device unavailable later - Message msg = mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT, address); - mAudioHandler.sendMessageDelayed(msg, delayMs); - + queueMsgUnderWakeLock(mAudioHandler, + MSG_BTA2DP_DOCK_TIMEOUT, + 0, + 0, + address, + delayMs); } // must be called synchronized on mConnectedDevices @@ -5912,7 +5937,8 @@ public class AudioService extends IAudioService.Stub private void onSetA2dpSinkConnectionState(BluetoothDevice btDevice, int state, int a2dpVolume) { if (DEBUG_DEVICES) { - Log.d(TAG, "onSetA2dpSinkConnectionState btDevice=" + btDevice+"state=" + state); + Log.d(TAG, "onSetA2dpSinkConnectionState btDevice= " + btDevice+" state= " + state + + " is dock: "+btDevice.isBluetoothDock()); } if (btDevice == null) { return; @@ -5949,7 +5975,7 @@ public class AudioService extends IAudioService.Stub } else { // this could be a connection of another A2DP device before the timeout of // a dock: cancel the dock timeout, and make the dock unavailable now - if(hasScheduledA2dpDockTimeout()) { + if (hasScheduledA2dpDockTimeout() && mDockAddress != null) { cancelA2dpDeviceTimeout(); makeA2dpDeviceUnavailableNow(mDockAddress); } @@ -6168,17 +6194,6 @@ public class AudioService extends IAudioService.Stub } } - if (mAudioHandler.hasMessages(MSG_SET_A2DP_SRC_CONNECTION_STATE) || - mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE) || - mAudioHandler.hasMessages(MSG_SET_HEARING_AID_CONNECTION_STATE) || - mAudioHandler.hasMessages(MSG_SET_WIRED_DEVICE_CONNECTION_STATE)) { - synchronized (mLastDeviceConnectMsgTime) { - long time = SystemClock.uptimeMillis(); - if (mLastDeviceConnectMsgTime > time) { - delay = (int)(mLastDeviceConnectMsgTime - time) + 30; - } - } - } return delay; } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index b0e6208fdff3..cd8fdbfbc647 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -3538,7 +3538,14 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // docked or freeform stack is visible...except for the home stack/task if the // docked stack is minimized and it actually set something. if (mHomeStack != null && mHomeStack.isVisible() - && mDividerControllerLocked.isMinimizedDock()) { + && mDividerControllerLocked.isMinimizedDock() + // TODO(b/110159357): Work around to unblock the release for failing test + // ActivityManagerAppConfigurationTests#testSplitscreenPortraitAppOrientationRequests + // which shouldn't be failing since home stack shouldn't be visible. We need + // to dig deeper to see why it is failing. NOTE: Not failing on current + // master... + && !(mDividerControllerLocked.isHomeStackResizable() + && mHomeStack.matchParentBounds())) { final int orientation = mHomeStack.getOrientation(); if (orientation != SCREEN_ORIENTATION_UNSET) { return orientation; |