diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-06-29 04:44:51 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-06-29 04:44:51 +0000 |
commit | 9bfcbe30ca407fe47c04ae1e0d9e0be272756adf (patch) | |
tree | 025babb6aabc58b8b9d31ec2d1e456ef0700f79d | |
parent | af0fec4b65fd25d6b82e8a689a942235aa84b4f0 (diff) | |
parent | b2ad6b20d515f665618c7451480ad2946ded1977 (diff) | |
download | base-9bfcbe30ca407fe47c04ae1e0d9e0be272756adf.tar.gz |
Merge cherrypicks of [2476230, 2476289, 2476272, 2476118, 2475997, 2476251, 2476119, 2476341, 2476252, 2476290, 2476232, 2476274, 2475999, 2476343, 2476275, 2476216, 2476381, 2476256, 2476000, 2476362, 2476345, 2476364, 2476234, 2476346, 2476347, 2476365, 2476276, 2476219, 2476277, 2476402, 2476348, 2476235, 2476383, 2476257, 2476278, 2476236, 2476350, 2476351, 2476307, 2476403, 2476308, 2476258] into oc-release
Change-Id: I3e45afab5b6c2e2a29e60638c33d090b368c4424
15 files changed, 71 insertions, 75 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index bc6e9cd0ab7e..0ff3215e1271 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -6416,17 +6416,7 @@ public class Activity extends ContextThemeWrapper */ @Deprecated public boolean requestVisibleBehind(boolean visible) { - if (!mResumed) { - // Do not permit paused or stopped activities to do this. - visible = false; - } - try { - mVisibleBehind = ActivityManager.getService() - .requestVisibleBehind(mToken, visible) && visible; - } catch (RemoteException e) { - mVisibleBehind = false; - } - return mVisibleBehind; + return false; } /** diff --git a/libs/hwui/GlopBuilder.cpp b/libs/hwui/GlopBuilder.cpp index 931a55a70fd8..248e92f7c97b 100644 --- a/libs/hwui/GlopBuilder.cpp +++ b/libs/hwui/GlopBuilder.cpp @@ -456,11 +456,13 @@ GlopBuilder& GlopBuilder::setFillTextureLayer(GlLayer& layer, float alpha) { return *this; } -GlopBuilder& GlopBuilder::setFillExternalTexture(Texture& texture, Matrix4& textureTransform) { +GlopBuilder& GlopBuilder::setFillExternalTexture(Texture& texture, Matrix4& textureTransform, + bool requiresFilter) { TRIGGER_STAGE(kFillStage); REQUIRE_STAGES(kMeshStage | kRoundRectClipStage); - mOutGlop->fill.texture = { &texture, GL_LINEAR, GL_CLAMP_TO_EDGE, &textureTransform }; + GLenum filter = requiresFilter ? GL_LINEAR : GL_NEAREST; + mOutGlop->fill.texture = { &texture, filter, GL_CLAMP_TO_EDGE, &textureTransform }; setFill(SK_ColorWHITE, 1.0f, SkBlendMode::kSrc, Blend::ModeOrderSwap::NoSwap, nullptr, nullptr); diff --git a/libs/hwui/GlopBuilder.h b/libs/hwui/GlopBuilder.h index 87b1568ed72b..6d11da19e138 100644 --- a/libs/hwui/GlopBuilder.h +++ b/libs/hwui/GlopBuilder.h @@ -75,7 +75,8 @@ public: GlopBuilder& setFillTextureLayer(GlLayer& layer, float alpha); // TODO: setFillLayer normally forces its own wrap & filter mode, // which isn't always correct. - GlopBuilder& setFillExternalTexture(Texture& texture, Matrix4& textureTransform); + GlopBuilder& setFillExternalTexture(Texture& texture, Matrix4& textureTransform, + bool requiresFilter); GlopBuilder& setTransform(const Matrix4& canvas, const int transformFlags); diff --git a/libs/hwui/OpenGLReadback.cpp b/libs/hwui/OpenGLReadback.cpp index c460c0d2dfd4..51927d5a2c61 100644 --- a/libs/hwui/OpenGLReadback.cpp +++ b/libs/hwui/OpenGLReadback.cpp @@ -191,6 +191,7 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState, GL_TEXTURE_2D, texture, 0); { + bool requiresFilter; // Draw & readback renderState.setViewport(destWidth, destHeight); renderState.scissor().setEnabled(false); @@ -208,12 +209,17 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState, croppedTexTransform.scale(srcRect.getWidth() / sourceTexture.width(), srcRect.getHeight() / sourceTexture.height(), 1); croppedTexTransform.multiply(sFlipV); + requiresFilter = srcRect.getWidth() != (float) destWidth + || srcRect.getHeight() != (float) destHeight; + } else { + requiresFilter = sourceTexture.width() != (uint32_t) destWidth + || sourceTexture.height() != (uint32_t) destHeight; } Glop glop; GlopBuilder(renderState, caches, &glop) .setRoundRectClipState(nullptr) .setMeshTexturedUnitQuad(nullptr) - .setFillExternalTexture(sourceTexture, croppedTexTransform) + .setFillExternalTexture(sourceTexture, croppedTexTransform, requiresFilter) .setTransform(Matrix4::identity(), TransformFlags::None) .setModelViewMapUnitToRect(Rect(destWidth, destHeight)) .build(); diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java index 3b29a6cd7b6c..1e262314284d 100644 --- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java +++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java @@ -77,7 +77,7 @@ public class DeviceDiscoveryService extends Service { private BluetoothAdapter mBluetoothAdapter; private WifiManager mWifiManager; - private BluetoothLeScanner mBLEScanner; + @Nullable private BluetoothLeScanner mBLEScanner; private ScanSettings mDefaultScanSettings = new ScanSettings.Builder().build(); private List<DeviceFilter<?>> mFilters; @@ -185,7 +185,7 @@ public class DeviceDiscoveryService extends Service { mBluetoothAdapter.startDiscovery(); } - if (shouldScan(mBLEFilters)) { + if (shouldScan(mBLEFilters) && mBLEScanner != null) { mBLEScanCallback = new BLEScanCallback(); mBLEScanner.startScan(mBLEScanFilters, mDefaultScanSettings, mBLEScanCallback); } @@ -224,7 +224,7 @@ public class DeviceDiscoveryService extends Service { unregisterReceiver(mBluetoothBroadcastReceiver); mBluetoothBroadcastReceiver = null; } - mBLEScanner.stopScan(mBLEScanCallback); + if (mBLEScanner != null) mBLEScanner.stopScan(mBLEScanCallback); if (mWifiBroadcastReceiver != null) { unregisterReceiver(mWifiBroadcastReceiver); mWifiBroadcastReceiver = null; diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index f66a09e04192..4245b1183e08 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -776,7 +776,4 @@ <dimen name="qs_gutter_height">6dp</dimen> - <!-- Width of the hollow triangle for empty signal state --> - <dimen name="mobile_signal_empty_strokewidth">2dp</dimen> - </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java index c09da2183076..bd4a1df246f3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java @@ -417,7 +417,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl @Override public void onHeightUpdate() { - if (mParent == null || mMenuItems.size() == 0) { + if (mParent == null || mMenuItems.size() == 0 || mMenuContainer == null) { return; } int parentHeight = mParent.getCollapsedHeight(); @@ -477,7 +477,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl private void setMenuLocation() { boolean showOnLeft = mTranslation > 0; - if ((mIconsPlaced && showOnLeft == mOnLeft) || mSnapping + if ((mIconsPlaced && showOnLeft == mOnLeft) || mSnapping || mMenuContainer == null || !mMenuContainer.isAttachedToWindow()) { // Do nothing return; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java index 983a79615304..1c34b7de2d4d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SignalDrawable.java @@ -85,12 +85,8 @@ public class SignalDrawable extends Drawable { {-1.9f / VIEWPORT, -1.9f / VIEWPORT}, }; - // The easiest way to understand this is as if we set Style.STROKE and draw the triangle, - // but that is only theoretically right. Instead, draw the triangle and clip out a smaller - // one inset by this amount. - private final float mEmptyStrokeWidth; private static final float INV_TAN = 1f / (float) Math.tan(Math.PI / 8f); - private final float mEmptyDiagInset; // == mEmptyStrokeWidth * INV_TAN + private static final float CUT_WIDTH_DP = 1f / 12f; private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint mForegroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); @@ -126,11 +122,6 @@ public class SignalDrawable extends Drawable { Utils.getDefaultColor(context, R.color.light_mode_icon_color_dual_tone_fill); mIntrinsicSize = context.getResources().getDimensionPixelSize(R.dimen.signal_icon_size); - // mCutPath parameters - mEmptyStrokeWidth = context.getResources() - .getDimensionPixelSize(R.dimen.mobile_signal_empty_strokewidth); - mEmptyDiagInset = mEmptyStrokeWidth * INV_TAN; - mHandler = new Handler(); setDarkIntensity(0); } @@ -262,20 +253,22 @@ public class SignalDrawable extends Drawable { } if (mState == STATE_EMPTY) { + final float cutWidth = CUT_WIDTH_DP * height; + final float cutDiagInset = cutWidth * INV_TAN; + // Cut out a smaller triangle from the center of mFullPath mCutPath.reset(); mCutPath.setFillType(FillType.WINDING); - mCutPath.moveTo(width - padding - mEmptyStrokeWidth, - height - padding - mEmptyStrokeWidth); - mCutPath.lineTo(width - padding - mEmptyStrokeWidth, padding + mEmptyDiagInset); - mCutPath.lineTo(padding + mEmptyDiagInset, height - padding - mEmptyStrokeWidth); - mCutPath.lineTo(width - padding - mEmptyStrokeWidth, - height - padding - mEmptyStrokeWidth); - - // In empty state, draw the full path as the foreground paint - mForegroundPath.set(mFullPath); - mFullPath.reset(); - mForegroundPath.op(mCutPath, Path.Op.DIFFERENCE); + mCutPath.moveTo(width - padding - cutWidth, + height - padding - cutWidth); + mCutPath.lineTo(width - padding - cutWidth, padding + cutDiagInset); + mCutPath.lineTo(padding + cutDiagInset, height - padding - cutWidth); + mCutPath.lineTo(width - padding - cutWidth, + height - padding - cutWidth); + + // Draw empty state as only background + mForegroundPath.reset(); + mFullPath.op(mCutPath, Path.Op.DIFFERENCE); } else if (mState == STATE_AIRPLANE) { // Airplane mode is slashed, full-signal mForegroundPath.set(mFullPath); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationMenuRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationMenuRowTest.java index e0d8042238d2..4aa987738572 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationMenuRowTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationMenuRowTest.java @@ -57,4 +57,10 @@ public class NotificationMenuRowTest extends LeakCheckedTest { row.createMenu(null); assertTrue(row.getMenuView() != null); } + + @Test + public void testResetUncreatedMenu() { + NotificationMenuRowPlugin row = new NotificationMenuRow(mContext); + row.resetMenu(); + } } diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java index 9e4d89cbc9c5..0e42e6d6a83d 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java @@ -271,6 +271,7 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo private void processKeyEvent(EventStreamState state, KeyEvent event, int policyFlags) { if (!state.shouldProcessKeyEvent(event)) { + super.onInputEvent(event, policyFlags); return; } mEventHandler.onKeyEvent(event, policyFlags); diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java index 4810f4fe8c82..f47b0d3c6e73 100644 --- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java @@ -383,7 +383,7 @@ public class CompanionDeviceManagerService extends SystemService implements Bind findDeviceCallback, getServiceCallback()); } catch (RemoteException e) { - throw new RuntimeException(e); + Log.e(LOG_TAG, "Error while initiating device discovery", e); } } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 607b84c4658e..186d0f40f43a 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -20,6 +20,7 @@ import static android.Manifest.permission.CHANGE_CONFIGURATION; import static android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST; import static android.Manifest.permission.INTERACT_ACROSS_USERS; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; +import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS; import static android.Manifest.permission.READ_FRAME_BUFFER; import static android.Manifest.permission.START_TASKS_FROM_RECENTS; @@ -10228,7 +10229,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void moveStackToDisplay(int stackId, int displayId) { - enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "moveStackToDisplay()"); + enforceCallingPermission(INTERNAL_SYSTEM_WINDOW, "moveStackToDisplay()"); synchronized (this) { final long ident = Binder.clearCallingIdentity(); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index fe0e07efe9bc..3de203669032 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -16,6 +16,7 @@ package com.android.server.am; +import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS; import static android.Manifest.permission.START_ANY_ACTIVITY; import static android.Manifest.permission.START_TASKS_FROM_RECENTS; @@ -38,11 +39,13 @@ import static android.app.ITaskStackListener.FORCED_RESIZEABLE_REASON_SPLIT_SCRE import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.pm.PackageManager.PERMISSION_GRANTED; +import static android.os.Process.SYSTEM_UID; import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.FLAG_PRIVATE; import static android.view.Display.INVALID_DISPLAY; import static android.view.Display.REMOVE_MODE_DESTROY_CONTENT; +import static android.view.Display.TYPE_VIRTUAL; import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_PICTURE_IN_PICTURE_EXPANDED_TO_FULLSCREEN; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL; @@ -1678,6 +1681,24 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return false; } + // Check if the caller can manage activity stacks. + final int startAnyPerm = mService.checkPermission(INTERNAL_SYSTEM_WINDOW, callingPid, + callingUid); + if (startAnyPerm == PERMISSION_GRANTED) { + if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check:" + + " allow launch any on display"); + return true; + } + + if (activityDisplay.mDisplay.getType() == TYPE_VIRTUAL + && activityDisplay.mDisplay.getOwnerUid() != SYSTEM_UID) { + // Limit launching on virtual displays, because their contents can be read from Surface + // by apps that created them. + if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check:" + + " disallow launch on virtual display for not-embedded activity"); + return false; + } + if (!activityDisplay.isPrivate()) { // Anyone can launch on a public display. if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check:" @@ -1699,15 +1720,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return true; } - // Check if the caller can manage activity stacks. - final int startAnyPerm = mService.checkPermission(MANAGE_ACTIVITY_STACKS, callingPid, - callingUid); - if (startAnyPerm == PERMISSION_GRANTED) { - if (DEBUG_TASKS) Slog.d(TAG, "Launch on display check:" - + " allow launch any on display"); - return true; - } - Slog.w(TAG, "Launch on display check: denied"); return false; } diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java index 184129e03e77..5095e518ed8a 100644 --- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java +++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java @@ -1017,7 +1017,7 @@ class PackageManagerShellCommand extends ShellCommand { throw new RuntimeException(e.getMessage(), e); } try { - ResolveInfo ri = mInterface.resolveIntent(intent, null, 0, mTargetUser); + ResolveInfo ri = mInterface.resolveIntent(intent, intent.getType(), 0, mTargetUser); PrintWriter pw = getOutPrintWriter(); if (ri == null) { pw.println("No activity found"); @@ -1039,7 +1039,7 @@ class PackageManagerShellCommand extends ShellCommand { throw new RuntimeException(e.getMessage(), e); } try { - List<ResolveInfo> result = mInterface.queryIntentActivities(intent, null, 0, + List<ResolveInfo> result = mInterface.queryIntentActivities(intent, intent.getType(), 0, mTargetUser).getList(); PrintWriter pw = getOutPrintWriter(); if (result == null || result.size() <= 0) { @@ -1073,7 +1073,7 @@ class PackageManagerShellCommand extends ShellCommand { throw new RuntimeException(e.getMessage(), e); } try { - List<ResolveInfo> result = mInterface.queryIntentServices(intent, null, 0, + List<ResolveInfo> result = mInterface.queryIntentServices(intent, intent.getType(), 0, mTargetUser).getList(); PrintWriter pw = getOutPrintWriter(); if (result == null || result.size() <= 0) { @@ -1107,7 +1107,7 @@ class PackageManagerShellCommand extends ShellCommand { throw new RuntimeException(e.getMessage(), e); } try { - List<ResolveInfo> result = mInterface.queryIntentReceivers(intent, null, 0, + List<ResolveInfo> result = mInterface.queryIntentReceivers(intent, intent.getType(), 0, mTargetUser).getList(); PrintWriter pw = getOutPrintWriter(); if (result == null || result.size() <= 0) { diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java index 5f34c6067997..4e4398ee9d91 100644 --- a/services/core/java/com/android/server/wm/AppWindowContainerController.java +++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java @@ -614,7 +614,7 @@ public class AppWindowContainerController return STARTING_WINDOW_TYPE_SPLASH_SCREEN; } else if (taskSwitch && allowTaskSnapshot) { return snapshot == null ? STARTING_WINDOW_TYPE_NONE - : snapshotOrientationSameAsDisplay(snapshot) || fromRecents + : snapshotOrientationSameAsTask(snapshot) || fromRecents ? STARTING_WINDOW_TYPE_SNAPSHOT : STARTING_WINDOW_TYPE_SPLASH_SCREEN; } else { return STARTING_WINDOW_TYPE_NONE; @@ -640,24 +640,11 @@ public class AppWindowContainerController return true; } - private boolean snapshotOrientationSameAsDisplay(TaskSnapshot snapshot) { + private boolean snapshotOrientationSameAsTask(TaskSnapshot snapshot) { if (snapshot == null) { return false; } - final Rect rect = new Rect(0, 0, snapshot.getSnapshot().getWidth(), - snapshot.getSnapshot().getHeight()); - rect.inset(snapshot.getContentInsets()); - final Rect taskBoundsWithoutInsets = new Rect(); - mContainer.getTask().getBounds(taskBoundsWithoutInsets); - final DisplayInfo di = mContainer.getDisplayContent().getDisplayInfo(); - final Rect displayBounds = new Rect(0, 0, di.logicalWidth, di.logicalHeight); - final Rect stableInsets = new Rect(); - mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, - stableInsets); - displayBounds.inset(stableInsets); - final boolean snapshotInLandscape = rect.width() >= rect.height(); - final boolean displayInLandscape = displayBounds.width() >= displayBounds.height(); - return snapshotInLandscape == displayInLandscape; + return mContainer.getTask().getConfiguration().orientation == snapshot.getOrientation(); } public void removeStartingWindow() { |