From 04ef4dcac26df3e01a3da972cfc2987ad8765f55 Mon Sep 17 00:00:00 2001 From: shreerag Date: Fri, 16 Jun 2017 18:54:37 -0700 Subject: [PATCH 01/16] Adding feature: input device disable/enable. This functionality will only be available for signed system applications. A disable call will cause a file descriptor to the input device driver to be closed, which in turn may cause the input device to switch into a low-power mode. An enable call will reopen the input device. Bug: 30143923 Test: developed a custom apk with signature permission that calls disable/enable on touchscreen device. Verified that touchscreen stops working when disable is called and starts working again when enable is called. Verified that the file handle to the driver is closed and reopened. Verified that the notification onInputDeviceChanged is received in the app. CTS test - android.view.cts.InputDeviceEnabledTest Change-Id: Ia352deb548b73559f821afd586893393d39a0696 --- .../android/hardware/input/IInputManager.aidl | 5 ++ .../android/hardware/input/InputManager.java | 56 +++++++++++++++++++ core/java/android/view/InputDevice.java | 34 +++++++++++ core/res/AndroidManifest.xml | 7 +++ .../server/input/InputManagerService.java | 29 ++++++++++ ...droid_server_input_InputManagerService.cpp | 52 +++++++++++++++++ 6 files changed, 183 insertions(+) diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl index bdb278bb8c344..45863167fa1b1 100644 --- a/core/java/android/hardware/input/IInputManager.aidl +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -34,6 +34,11 @@ interface IInputManager { InputDevice getInputDevice(int deviceId); int[] getInputDeviceIds(); + // Enable/disable input device. + boolean isInputDeviceEnabled(int deviceId); + void enableInputDevice(int deviceId); + void disableInputDevice(int deviceId); + // Reports whether the hardware supports the given keys; returns true if successful boolean hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists); diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java index 5149e930d94ab..01e7d06eb3344 100644 --- a/core/java/android/hardware/input/InputManager.java +++ b/core/java/android/hardware/input/InputManager.java @@ -318,6 +318,62 @@ public final class InputManager { } } + /** + * Returns true if an input device is enabled. Should return true for most + * situations. Some system apps may disable an input device, for + * example to prevent unwanted touch events. + * + * @param id The input device Id. + * + * @hide + */ + public boolean isInputDeviceEnabled(int id) { + try { + return mIm.isInputDeviceEnabled(id); + } catch (RemoteException ex) { + Log.w(TAG, "Could not check enabled status of input device with id = " + id); + throw ex.rethrowFromSystemServer(); + } + } + + /** + * Enables an InputDevice. + *

+ * Requires {@link android.Manifest.permissions.DISABLE_INPUT_DEVICE}. + *

+ * + * @param id The input device Id. + * + * @hide + */ + public void enableInputDevice(int id) { + try { + mIm.enableInputDevice(id); + } catch (RemoteException ex) { + Log.w(TAG, "Could not enable input device with id = " + id); + throw ex.rethrowFromSystemServer(); + } + } + + /** + * Disables an InputDevice. + *

+ * Requires {@link android.Manifest.permissions.DISABLE_INPUT_DEVICE}. + *

+ * + * @param id The input device Id. + * + * @hide + */ + public void disableInputDevice(int id) { + try { + mIm.disableInputDevice(id); + } catch (RemoteException ex) { + Log.w(TAG, "Could not disable input device with id = " + id); + throw ex.rethrowFromSystemServer(); + } + } + /** * Registers an input device listener to receive notifications about when * input devices are added, removed or changed. diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index ea2434e9e39db..f2ac3dfc3869a 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -16,6 +16,8 @@ package android.view; +import android.annotation.RequiresPermission; +import android.annotation.TestApi; import android.content.Context; import android.hardware.input.InputDeviceIdentifier; import android.hardware.input.InputManager; @@ -767,6 +769,38 @@ public final class InputDevice implements Parcelable { } } + /** + * Returns true if input device is enabled. + * @return Whether the input device is enabled. + * + * @hide + */ + public boolean isEnabled() { + return InputManager.getInstance().isInputDeviceEnabled(mId); + } + + /** + * Enables the input device. + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.DISABLE_INPUT_DEVICE) + @TestApi + public void enable() { + InputManager.getInstance().enableInputDevice(mId); + } + + /** + * Disables the input device. + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.DISABLE_INPUT_DEVICE) + @TestApi + public void disable() { + InputManager.getInstance().disableInputDevice(mId); + } + /** * Reports whether the device has a built-in microphone. * @return Whether the device has a built-in microphone. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 794d4f8b78b93..790f887bd4a85 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2734,6 +2734,13 @@ + + + #include #include +#include #include #include @@ -203,6 +204,7 @@ public: void setInputDispatchMode(bool enabled, bool frozen); void setSystemUiVisibility(int32_t visibility); void setPointerSpeed(int32_t speed); + void setInputDeviceEnabled(uint32_t deviceId, bool enabled); void setShowTouches(bool enabled); void setInteractive(bool interactive); void reloadCalibration(); @@ -288,6 +290,9 @@ private: // Pointer controller singleton, created and destroyed as needed. wp pointerController; + + // Input devices to be disabled + SortedVector disabledInputDevices; } mLocked; std::atomic mInteractive; @@ -512,6 +517,8 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon outConfig->setPhysicalDisplayViewport(ViewportType::VIEWPORT_EXTERNAL, mLocked.externalViewport); outConfig->setVirtualDisplayViewports(mLocked.virtualViewports); + + outConfig->disabledDevices = mLocked.disabledInputDevices; } // release lock } @@ -801,6 +808,24 @@ void NativeInputManager::setPointerSpeed(int32_t speed) { InputReaderConfiguration::CHANGE_POINTER_SPEED); } +void NativeInputManager::setInputDeviceEnabled(uint32_t deviceId, bool enabled) { + { // acquire lock + AutoMutex _l(mLock); + + ssize_t index = mLocked.disabledInputDevices.indexOf(deviceId); + bool currentlyEnabled = index < 0; + if (!enabled && currentlyEnabled) { + mLocked.disabledInputDevices.add(deviceId); + } + if (enabled && !currentlyEnabled) { + mLocked.disabledInputDevices.remove(deviceId); + } + } // release lock + + mInputManager->getReader()->requestRefreshConfiguration( + InputReaderConfiguration::CHANGE_ENABLED_STATE); +} + void NativeInputManager::setShowTouches(bool enabled) { { // acquire lock AutoMutex _l(mLock); @@ -1529,6 +1554,27 @@ static void nativeMonitor(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) { im->getInputManager()->getDispatcher()->monitor(); } +static jboolean nativeIsInputDeviceEnabled(JNIEnv* env /* env */, + jclass /* clazz */, jlong ptr, jint deviceId) { + NativeInputManager* im = reinterpret_cast(ptr); + + return im->getInputManager()->getReader()->isInputDeviceEnabled(deviceId); +} + +static void nativeEnableInputDevice(JNIEnv* /* env */, + jclass /* clazz */, jlong ptr, jint deviceId) { + NativeInputManager* im = reinterpret_cast(ptr); + + im->setInputDeviceEnabled(deviceId, true); +} + +static void nativeDisableInputDevice(JNIEnv* /* env */, + jclass /* clazz */, jlong ptr, jint deviceId) { + NativeInputManager* im = reinterpret_cast(ptr); + + im->setInputDeviceEnabled(deviceId, false); +} + static void nativeSetPointerIconType(JNIEnv* /* env */, jclass /* clazz */, jlong ptr, jint iconId) { NativeInputManager* im = reinterpret_cast(ptr); im->setPointerIconType(iconId); @@ -1621,6 +1667,12 @@ static const JNINativeMethod gInputManagerMethods[] = { (void*) nativeDump }, { "nativeMonitor", "(J)V", (void*) nativeMonitor }, + { "nativeIsInputDeviceEnabled", "(JI)Z", + (void*) nativeIsInputDeviceEnabled }, + { "nativeEnableInputDevice", "(JI)V", + (void*) nativeEnableInputDevice }, + { "nativeDisableInputDevice", "(JI)V", + (void*) nativeDisableInputDevice }, { "nativeSetPointerIconType", "(JI)V", (void*) nativeSetPointerIconType }, { "nativeReloadPointerIcons", "(J)V", From 86eaa4b921595d64eb1690f454aabc20b17a3469 Mon Sep 17 00:00:00 2001 From: shreerag Date: Wed, 21 Jun 2017 13:13:36 -0700 Subject: [PATCH 02/16] Removing @TestApi from inputdevice enable/disable to fix build Change-Id: I4f4602aeb6eb5280b70d56645122bb9fc1fab69c --- core/java/android/view/InputDevice.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index f2ac3dfc3869a..f6fee2dfa7376 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -785,7 +785,6 @@ public final class InputDevice implements Parcelable { * @hide */ @RequiresPermission(android.Manifest.permission.DISABLE_INPUT_DEVICE) - @TestApi public void enable() { InputManager.getInstance().enableInputDevice(mId); } @@ -796,7 +795,6 @@ public final class InputDevice implements Parcelable { * @hide */ @RequiresPermission(android.Manifest.permission.DISABLE_INPUT_DEVICE) - @TestApi public void disable() { InputManager.getInstance().disableInputDevice(mId); } From 10efdc0abfbc2b26e4c49cb8ffb02e52edcd287e Mon Sep 17 00:00:00 2001 From: Michael Kwan Date: Fri, 14 Apr 2017 12:34:46 -0700 Subject: [PATCH 03/16] Add isSmallBatteryDevice flag to ActivityManager. Bug: 37351903 Change-Id: I6fed08c35474b10987388070eafb7b16e6944638 (cherry picked from commit 15eb998e65eceef991a55cf15dba9f1769b182db) --- core/java/android/app/ActivityManager.java | 12 ++++++++++++ .../com/android/internal/os/RoSystemProperties.java | 2 ++ 2 files changed, 14 insertions(+) diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index f398c8dc9d6a2..8fa06786252bd 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -1111,6 +1111,18 @@ public class ActivityManager { return RoSystemProperties.CONFIG_LOW_RAM; } + /** + * Returns true if this is a small battery device. Exactly whether a device is considered to be + * small battery is ultimately up to the device configuration, but currently it generally means + * something in the class of a device with 1000 mAh or less. This is mostly intended to be used + * to determine whether certain features should be altered to account for a drastically smaller + * battery. + * @hide + */ + public static boolean isSmallBatteryDevice() { + return RoSystemProperties.CONFIG_SMALL_BATTERY; + } + /** * Used by persistent processes to determine if they are running on a * higher-end device so should be okay using hardware drawing acceleration diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java index 1d26df0de12cb..89a4e17aa9767 100644 --- a/core/java/com/android/internal/os/RoSystemProperties.java +++ b/core/java/com/android/internal/os/RoSystemProperties.java @@ -33,6 +33,8 @@ public class RoSystemProperties { // ------ ro.config.* -------- // public static final boolean CONFIG_LOW_RAM = SystemProperties.getBoolean("ro.config.low_ram", false); + public static final boolean CONFIG_SMALL_BATTERY = + SystemProperties.getBoolean("ro.config.small_battery", false); // ------ ro.fw.* ------------ // public static final boolean FW_SYSTEM_USER_SPLIT = From ff5273052ad29b94ba7ea95a66421dc89ebefb25 Mon Sep 17 00:00:00 2001 From: Erik Wolsheimer Date: Tue, 6 Jun 2017 14:58:35 -0700 Subject: [PATCH 04/16] Fix error caused by quick stopDream(false) + startDream() with same dream Bug: 62147987 Bug: 28455483 Change-Id: I4577c66d7d66c22c8b9e2ab0b50a59e97d7e9647 --- .../android/server/dreams/DreamManagerService.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/dreams/DreamManagerService.java b/services/core/java/com/android/server/dreams/DreamManagerService.java index dbccc0765b739..77587f9cec6a7 100644 --- a/services/core/java/com/android/server/dreams/DreamManagerService.java +++ b/services/core/java/com/android/server/dreams/DreamManagerService.java @@ -86,6 +86,7 @@ public final class DreamManagerService extends SystemService { private boolean mCurrentDreamCanDoze; private boolean mCurrentDreamIsDozing; private boolean mCurrentDreamIsWaking; + private Runnable mStopDreamRunnable; private int mCurrentDreamDozeScreenState = Display.STATE_UNKNOWN; private int mCurrentDreamDozeScreenBrightness = PowerManager.BRIGHTNESS_DEFAULT; @@ -354,6 +355,12 @@ public final class DreamManagerService extends SystemService { && mCurrentDreamCanDoze == canDoze && mCurrentDreamUserId == userId) { Slog.i(TAG, "Already in target dream."); + // If dream is waking, cancel the wake. + mCurrentDreamIsWaking = false; + if (mStopDreamRunnable != null) { + mHandler.removeCallbacks(mStopDreamRunnable); + mStopDreamRunnable = null; + } return; } @@ -386,13 +393,15 @@ public final class DreamManagerService extends SystemService { mCurrentDreamIsWaking = true; } - mHandler.post(new Runnable() { + mStopDreamRunnable = new Runnable() { @Override public void run() { Slog.i(TAG, "Performing gentle wake from dream."); mController.stopDream(immediate); + mStopDreamRunnable = null; } - }); + }; + mHandler.post(mStopDreamRunnable); } } From 8c5c7cc233f63bb3ae4c2916d7fb7cc4bce5a91a Mon Sep 17 00:00:00 2001 From: Anthony Hugh Date: Tue, 22 Nov 2016 15:13:35 -0800 Subject: [PATCH 05/16] DO NOT MERGE: Properly set FLAG_ACTIVITY_BROUGHT_TO_FRONT for onNewIntent() callback It looks like there was a regression where #onNewIntent() was called before the FLAG_ACTIVITY_BROUGHT_TO_FRONT flag was set. This change updates the code so we set the flag properly. BUG: 33034247 Change-Id: I61959a289dc5af14ee9d3d7bfa213191238efc88 --- .../android/server/am/ActivityStarter.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index be30d5aaeab95..62d0f8074a2ff 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1090,6 +1090,9 @@ class ActivityStarter { top.getTask().setIntent(mStartActivity); } ActivityStack.logStartActivity(AM_NEW_INTENT, mStartActivity, top.getTask()); + if (shouldActivityBeBroughtToFront(reusedActivity)) { + mStartActivity.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); + } top.deliverNewIntentLocked(mCallingUid, mStartActivity.intent, mStartActivity.launchedFromPackage); } @@ -1561,6 +1564,16 @@ class ActivityStarter { return DEFAULT_DISPLAY; } + private boolean shouldActivityBeBroughtToFront(ActivityRecord intentActivity) { + final ActivityStack focusStack = mSupervisor.getFocusedStack(); + ActivityRecord curTop = (focusStack == null) + ? null : focusStack.topRunningNonDelayedActivityLocked(mNotTop); + final TaskRecord topTask = curTop != null ? curTop.getTask() : null; + return topTask != null + && (topTask != intentActivity.getTask() || topTask != focusStack.topTask()) + && !mAvoidMoveToFront; + } + /** * Figure out which task and activity to bring to front when we have found an existing matching * activity record in history. May also clear the task if needed. @@ -1575,14 +1588,8 @@ class ActivityStarter { // the same behavior as if a new instance was being started, which means not bringing it // to the front if the caller is not itself in the front. final ActivityStack focusStack = mSupervisor.getFocusedStack(); - ActivityRecord curTop = (focusStack == null) - ? null : focusStack.topRunningNonDelayedActivityLocked(mNotTop); - final TaskRecord topTask = curTop != null ? curTop.getTask() : null; - if (topTask != null - && (topTask != intentActivity.getTask() || topTask != focusStack.topTask()) - && !mAvoidMoveToFront) { - mStartActivity.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); + if (shouldActivityBeBroughtToFront(intentActivity)) { if (mSourceRecord == null || (mSourceStack.topActivity() != null && mSourceStack.topActivity().getTask() == mSourceRecord.getTask())) { // We really do want to push this one into the user's face, right now. From 5297b37c6f975894f370d464bbeae6a620266f74 Mon Sep 17 00:00:00 2001 From: Erik Wolsheimer Date: Thu, 20 Oct 2016 21:09:44 -0700 Subject: [PATCH 06/16] DO NOT MERGE Allow Wear Home app to send wallpaper commands at any time Bug: 32333657 Change-Id: I6f030b6288433b9cefce0f2fb1a69de61bfa7617 --- .../java/com/android/server/wm/WallpaperController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java index 7213c9518d163..45a6a536d2e86 100644 --- a/services/core/java/com/android/server/wm/WallpaperController.java +++ b/services/core/java/com/android/server/wm/WallpaperController.java @@ -358,7 +358,14 @@ class WallpaperController { Bundle sendWindowWallpaperCommand( WindowState window, String action, int x, int y, int z, Bundle extras, boolean sync) { - if (window == mWallpaperTarget || window == mPrevWallpaperTarget) { + + // HACK(ewol): Custom whitelist for Wear Home app, to allow it to update the wallpaper + // regardless of what window is targeted. + // http://b/32172459 + final boolean hackWearWhitelisted = (window != null) && (window.mAttrs != null) + && "com.google.android.wearable.app".equals(window.mAttrs.packageName); + + if (hackWearWhitelisted || window == mWallpaperTarget || window == mPrevWallpaperTarget) { boolean doWait = sync; for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) { final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx); From 95434b51af894da6cbbbe58cce90dd883c5b0384 Mon Sep 17 00:00:00 2001 From: Calvin On Date: Thu, 15 Jun 2017 17:50:45 -0700 Subject: [PATCH 07/16] DO NOT MERGE ANYWHERE: Allow NetTransitionWakelock to be overridden via Settings Bug: 30574433 Change-Id: If0d2a0b99266d60557623105728feace9ea16943 --- core/java/android/provider/Settings.java | 10 +++++ .../android/server/ConnectivityService.java | 42 +++++++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 9e74c8e21e8c8..d013b1042b48e 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7876,6 +7876,16 @@ public final class Settings { */ public static final String NETWORK_SCORER_APP = "network_scorer_app"; + /** + * Configures the duration of the the ConnectivityService net transition wakelock. + * + * A setting of > 0 enacts this override duration in favor of the default or + * any other configured wakelock duration. + * A setting of == 0 effectively disables the net transition wakelock. + */ + public static final String NET_TRANSITION_WAKELOCK_OVERRIDE_MS = + "net_transition_wakelock_override_ms"; + /** * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 4b12bc48b49e7..3791c8d3abfbc 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -39,9 +39,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.pm.PackageManager; import android.content.res.Configuration; -import android.content.res.Resources; import android.database.ContentObserver; import android.net.ConnectivityManager; import android.net.ConnectivityManager.PacketKeepalive; @@ -100,7 +98,6 @@ import android.text.TextUtils; import android.util.LocalLog; import android.util.LocalLog.ReadOnlyLocalLog; import android.util.Log; -import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.util.SparseBooleanArray; @@ -122,7 +119,6 @@ import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.MessageUtils; import com.android.internal.util.WakeupMessage; import com.android.internal.util.XmlUtils; -import com.android.server.LocalServices; import com.android.server.am.BatteryStatsService; import com.android.server.connectivity.DataConnectionStats; import com.android.server.connectivity.KeepaliveTracker; @@ -384,6 +380,11 @@ public class ConnectivityService extends IConnectivityManager.Stub */ private static final int EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT = 31; + /** + * + */ + private static final int EVENT_CONFIGURE_NET_TRANSITION_WAKELOCK_OVERRIDE = 32; + /** Handler thread used for both of the handlers below. */ @VisibleForTesting protected final HandlerThread mHandlerThread; @@ -878,6 +879,23 @@ public class ConnectivityService extends IConnectivityManager.Stub } } + private void updateNetTransitionWakelockOverride() { + int override = Settings.Global.getInt( + mContext.getContentResolver(), + Settings.Global.NET_TRANSITION_WAKELOCK_OVERRIDE_MS, + -1); + if (override >= 0) { + mNetTransitionWakeLockTimeout = override; + if (DBG) log("mNetTransitionWakeLockTimeout overridden to " + + mNetTransitionWakeLockTimeout + " ms"); + } else { + mNetTransitionWakeLockTimeout = mContext.getResources().getInteger( + com.android.internal.R.integer.config_networkTransitionTimeout); + if (DBG) log("mNetTransitionWakeLockTimeout configured to " + + mNetTransitionWakeLockTimeout + " ms"); + } + } + private void registerSettingsCallbacks() { // Watch for global HTTP proxy changes. mSettingsObserver.observe( @@ -888,6 +906,11 @@ public class ConnectivityService extends IConnectivityManager.Stub mSettingsObserver.observe( Settings.Global.getUriFor(Settings.Global.MOBILE_DATA_ALWAYS_ON), EVENT_CONFIGURE_MOBILE_DATA_ALWAYS_ON); + + // Watch for changes to the override of the net transition wakelock duration. + mSettingsObserver.observe( + Settings.Global.getUriFor(Settings.Global.NET_TRANSITION_WAKELOCK_OVERRIDE_MS), + EVENT_CONFIGURE_NET_TRANSITION_WAKELOCK_OVERRIDE); } private synchronized int nextNetworkRequestId() { @@ -1638,6 +1661,9 @@ public class ConnectivityService extends IConnectivityManager.Stub // Configure whether mobile data is always on. mHandler.sendMessage(mHandler.obtainMessage(EVENT_CONFIGURE_MOBILE_DATA_ALWAYS_ON)); + mHandler.sendMessage( + mHandler.obtainMessage(EVENT_CONFIGURE_NET_TRANSITION_WAKELOCK_OVERRIDE)); + mHandler.sendMessage(mHandler.obtainMessage(EVENT_SYSTEM_READY)); mPermissionMonitor.startMonitoring(); @@ -2851,6 +2877,10 @@ public class ConnectivityService extends IConnectivityManager.Stub handleMobileDataAlwaysOn(); break; } + case EVENT_CONFIGURE_NET_TRANSITION_WAKELOCK_OVERRIDE: { + updateNetTransitionWakelockOverride(); + break; + } // Sent by KeepaliveTracker to process an app request on the state machine thread. case NetworkAgent.CMD_START_PACKET_KEEPALIVE: { mKeepaliveTracker.handleStartKeepalive(msg); @@ -3023,6 +3053,10 @@ public class ConnectivityService extends IConnectivityManager.Stub // becomes CONNECTED, whichever happens first. The timer is started by the // first caller and not restarted by subsequent callers. private void requestNetworkTransitionWakelock(String forWhom) { + if (mNetTransitionWakeLockTimeout <= 0) { + return; + } + int serialNum = 0; synchronized (this) { if (mNetTransitionWakeLock.isHeld()) return; From da2c28371231259f73b282122a41468fdb06ae39 Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Thu, 13 Jul 2017 12:07:20 -0700 Subject: [PATCH 08/16] CameraManager: Handle camera service being disabled explicitly Previously, CameraManager handled a disabled camera service implicitly, the same as it handles a temporarily-crashed camera service. However, the error reporting for the those cases isn't really the same, so switch to being explicit - check for the disabled camera service system property, and if it's set, short-circuit calls. Test: Camera CTS continues to pass, Watch device with no camera service also now passes camera CTS. Bug: 62269118 Change-Id: I65a97f8c1b0f101999b2c04d4f1096b7f3aee858 (cherry picked from commit 19d96a197fbbca281c907f14af294dae2a8b4db1) --- .../hardware/camera2/CameraManager.java | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java index 1b150bfca63a3..90bf896c2225b 100644 --- a/core/java/android/hardware/camera2/CameraManager.java +++ b/core/java/android/hardware/camera2/CameraManager.java @@ -16,28 +16,29 @@ package android.hardware.camera2; -import android.annotation.RequiresPermission; -import android.annotation.SystemService; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.RequiresPermission; +import android.annotation.SystemService; import android.content.Context; -import android.hardware.ICameraService; -import android.hardware.ICameraServiceListener; import android.hardware.CameraInfo; import android.hardware.CameraStatus; +import android.hardware.ICameraService; +import android.hardware.ICameraServiceListener; import android.hardware.camera2.impl.CameraMetadataNative; import android.hardware.camera2.legacy.CameraDeviceUserShim; import android.hardware.camera2.legacy.LegacyMetadataMapper; -import android.os.IBinder; import android.os.Binder; import android.os.DeadObjectException; import android.os.Handler; +import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; -import android.util.Log; +import android.os.SystemProperties; import android.util.ArrayMap; +import android.util.Log; import java.util.ArrayList; @@ -210,7 +211,9 @@ public final class CameraManager { public CameraCharacteristics getCameraCharacteristics(@NonNull String cameraId) throws CameraAccessException { CameraCharacteristics characteristics = null; - + if (CameraManagerGlobal.sCameraServiceDisabled) { + throw new IllegalArgumentException("No cameras available on device"); + } synchronized (mLock) { /* * Get the camera characteristics from the camera service directly if it supports it, @@ -462,6 +465,9 @@ public final class CameraManager { "Handler argument is null, but no looper exists in the calling thread"); } } + if (CameraManagerGlobal.sCameraServiceDisabled) { + throw new IllegalArgumentException("No cameras available on device"); + } openCameraDeviceUserAsync(cameraId, callback, handler, clientUid); } @@ -507,6 +513,9 @@ public final class CameraManager { */ public void setTorchMode(@NonNull String cameraId, boolean enabled) throws CameraAccessException { + if (CameraManagerGlobal.sCameraServiceDisabled) { + throw new IllegalArgumentException("No cameras available on device"); + } CameraManagerGlobal.get().setTorchMode(cameraId, enabled); } @@ -745,6 +754,9 @@ public final class CameraManager { private CameraManagerGlobal() { } + public static final boolean sCameraServiceDisabled = + SystemProperties.getBoolean("config.disable_cameraservice", false); + public static CameraManagerGlobal get() { return gCameraManager; } @@ -764,7 +776,7 @@ public final class CameraManager { public ICameraService getCameraService() { synchronized(mLock) { connectCameraServiceLocked(); - if (mCameraService == null) { + if (mCameraService == null && !sCameraServiceDisabled) { Log.e(TAG, "Camera service is unavailable"); } return mCameraService; @@ -779,7 +791,7 @@ public final class CameraManager { */ private void connectCameraServiceLocked() { // Only reconnect if necessary - if (mCameraService != null) return; + if (mCameraService != null || sCameraServiceDisabled) return; Log.i(TAG, "Connecting to camera service"); From 2f272bf32600d9073036165659216d9254e87b4e Mon Sep 17 00:00:00 2001 From: Calvin On Date: Mon, 17 Jul 2017 13:28:25 -0700 Subject: [PATCH 09/16] DO NOT MERGE ANYWHERE: Fix build Hide NET_TRANSITION_WAKELOCK_OVERRIDE_MS setting Bug: 63760887 Bug: 30574433 Change-Id: I6069e275cfd64a2c994b14962df1ca31f39d3943 --- core/java/android/provider/Settings.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index d013b1042b48e..8a0c2b5046b74 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7882,6 +7882,7 @@ public final class Settings { * A setting of > 0 enacts this override duration in favor of the default or * any other configured wakelock duration. * A setting of == 0 effectively disables the net transition wakelock. + * @hide */ public static final String NET_TRANSITION_WAKELOCK_OVERRIDE_MS = "net_transition_wakelock_override_ms"; From 64b9cfecbc7b90f55877d1d7d23b79be1fd361fd Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 26 Jul 2017 10:22:32 -0700 Subject: [PATCH 10/16] Import translations. DO NOT MERGE Change-Id: I845591a10b25b12451ddb1a6591b8b638630e32c Auto-generated-cl: translation import Exempt-From-Owner-Approval: translation import --- packages/SettingsLib/res/values-pt-rBR/arrays.xml | 4 ++-- packages/SettingsLib/res/values-pt-rBR/strings.xml | 2 +- packages/SettingsLib/res/values-pt-rPT/strings.xml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/SettingsLib/res/values-pt-rBR/arrays.xml b/packages/SettingsLib/res/values-pt-rBR/arrays.xml index a444b59be6b1f..e3f287bb3829f 100644 --- a/packages/SettingsLib/res/values-pt-rBR/arrays.xml +++ b/packages/SettingsLib/res/values-pt-rBR/arrays.xml @@ -190,9 +190,9 @@ "Animação desativada" - "Escala de animação 5x" + "Escala de animação 0,5x" "Escala de animação 1x" - "Escala de animação 1.5 x" + "Escala de animação 1,5x" "Escala de animação 2x" "Escala de animação 5x" "Escala de animação 10x" diff --git a/packages/SettingsLib/res/values-pt-rBR/strings.xml b/packages/SettingsLib/res/values-pt-rBR/strings.xml index 98ef4cb512b67..e0683a8fc3140 100644 --- a/packages/SettingsLib/res/values-pt-rBR/strings.xml +++ b/packages/SettingsLib/res/values-pt-rBR/strings.xml @@ -81,7 +81,7 @@ "Não foi possível parear com %1$s." "Não foi possível parear com %1$s por causa de um PIN ou senha incorretos." "Não é possível se comunicar com %1$s." - "Emparelhamento rejeitado por %1$s." + "Pareamento rejeitado por %1$s." "Wi-Fi desligado." "Wi-Fi desconectado" "Uma barra de Wi-Fi." diff --git a/packages/SettingsLib/res/values-pt-rPT/strings.xml b/packages/SettingsLib/res/values-pt-rPT/strings.xml index 00f0b5eb9192b..6889e01553964 100644 --- a/packages/SettingsLib/res/values-pt-rPT/strings.xml +++ b/packages/SettingsLib/res/values-pt-rPT/strings.xml @@ -272,8 +272,8 @@ "Limite proc. em 2º plano" "Mostrar todos os ANR" "Mostrar erro \"Aplic. não Resp.\" p/ aplic. 2º plano" - "Mostrar avisos do canal de notif." - "Mostra um aviso no ecrã quando uma aplic. publica uma notific. sem um canal válido" + "Mostrar avisos do canal de notificações" + "Mostra um aviso no ecrã quando uma aplicação publica uma notificação sem o canal ser válido" "Forçar perm. de aplicações no armazenamento ext." "Torna qualquer aplicação elegível para ser gravada no armazenamento externo, independentemente dos valores do manifesto" "Forçar as atividades a serem redimensionáveis" From 80ce6cf1ee6f32f151f839e2f553a44740a9c82c Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 26 Jul 2017 10:46:30 -0700 Subject: [PATCH 11/16] Import translations. DO NOT MERGE Change-Id: I1cfa4e4737d8fe82c6c39d1772d565c56ce186c4 Auto-generated-cl: translation import Exempt-From-Owner-Approval: translation import --- core/res/res/values-pt-rBR/strings.xml | 4 +- core/res/res/values-pt-rPT/strings.xml | 96 +++++++++++++------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/core/res/res/values-pt-rBR/strings.xml b/core/res/res/values-pt-rBR/strings.xml index 5fd500a12ab3a..18d84558dbdd6 100644 --- a/core/res/res/values-pt-rBR/strings.xml +++ b/core/res/res/values-pt-rBR/strings.xml @@ -1186,7 +1186,7 @@ "Conectado a um acessório USB" "Toque para ver mais opções." "Depuração USB conectada" - "Toque para desativar a depuração do USB." + "Toque para desativar a depuração USB." "Selecione para desativar a depuração USB." "Gerando relatório do bug..." "Compartilhar relatório do bug?" @@ -1621,7 +1621,7 @@ "Instalado pelo seu administrador" "Atualizado pelo seu administrador" "Excluído pelo seu administrador" - "A economia de bateria reduz o desempenho e os limites de vibração do dispositivo, os serviços de localização e a maioria dos dados em segundo plano para aumentar a duração da bateria. E-mails, mensagens e outros aplicativos que dependem de sincronização não serão atualizados, a não ser que você os abra.\n\nA economia de bateria é desligada automaticamente quando o dispositivo está sendo carregado." + "A economia de bateria reduz o desempenho do dispositivo e limita a vibração, os serviços de localização e a maioria dos dados em segundo plano para aumentar a duração da bateria. E-mails, mensagens e outros apps que dependem de sincronização não serão atualizados, a não ser que você os abra.\n\nA economia de bateria é desligada automaticamente quando o dispositivo está sendo carregado." "Para ajudar a reduzir o uso de dados, a Economia de dados impede que alguns apps enviem ou recebam dados em segundo plano. Um app que você esteja usando no momento pode acessar dados, mas com menos frequência. Isso pode significar que as imagens não serão exibidas até que você toque nelas." "Ativar Economia de dados?" "Ativar" diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml index 2e67deb371826..c892891a7e455 100644 --- a/core/res/res/values-pt-rPT/strings.xml +++ b/core/res/res/values-pt-rPT/strings.xml @@ -63,7 +63,7 @@ "Introduza o PUK2 para desbloquear o cartão SIM." "Ação sem êxito. Ative o bloqueio do SIM/RUIM." - You have %d remaining attempts before SIM is locked. + Tem mais %d tentativa antes de o cartão SIM ficar bloqueado. Tem mais %d tentativas antes de o cartão SIM ficar bloqueado. "IMEI" @@ -176,7 +176,7 @@ "O armazenamento da TV está cheio. Elimine alguns ficheiros para libertar espaço." "O armazenamento do telemóvel está cheio. Elimine alguns ficheiros para libertar espaço." - Certificate authorities installed + Autoridade de certificação instalada Autoridades de certificação instaladas "Por um terceiro desconhecido" @@ -232,7 +232,7 @@ "Relatório completo" "Utilize esta opção para uma interferência mínima do sistema quando o dispositivo não responder ou estiver demasiado lento, ou quando precisar de todas as secções de relatório. Não permite introduzir mais detalhes ou tirar capturas de ecrã adicionais." - Taking screenshot for bug report in %d seconds. + A tirar uma captura de ecrã do relatório de erro dentro de %d segundo… A tirar uma captura de ecrã do relatório de erro dentro de %d segundos. "Modo silencioso" @@ -868,7 +868,7 @@ "Há 1 mês" "Há mais de 1 mês" - Last %d days + Último %d dia Últimos %d dias "Último mês" @@ -890,67 +890,67 @@ "anos" "agora" - %dm - %dm + %d m + %d m - %dh - %dh + %d h + %d h - %dd - %dd + %d d + %d d - %dy - %da + %d a + %d a - in %dm - dentro de %dm + dentro de %d min + dentro de %d min - in %dh - dentro de %dh + dentro de %d h + dentro de %d h - in %dd - dentro de %dd + dentro de %d d + dentro de %d d - in %dy - dentro de %da + dentro de %d a + dentro de %d a - %d minutes ago + há %d minuto há %d minutos - %d hours ago + há %d hora há %d horas - %d days ago + há %d dia há %d dias - %d years ago + há %d ano há %d anos - in %d minutes + dentro de %d minuto dentro de %d minutos - in %d hours + dentro de %d hora dentro de %d horas - in %d days + dentro de %d dia dentro de %d dias - in %d years + dentro de %d ano dentro de %d anos "Problema com o vídeo" @@ -1099,11 +1099,11 @@ "Sons de notificação" "Desconhecido" - Wi-Fi networks available + Rede Wi-Fi disponível Redes Wi-Fi disponíveis - Open Wi-Fi networks available + Rede Wi-Fi aberta disponível Redes Wi-Fi abertas disponíveis "Iniciar sessão na rede Wi-Fi" @@ -1155,7 +1155,7 @@ "Enviar" "Cancelar" "Memorizar a minha escolha" - "Pode depois alterar isto em Definições > Aplicações" + "Pode alterar mais tarde em Definições > Aplicações" "Permitir Sempre" "Nunca Permitir" "Cartão SIM removido" @@ -1187,7 +1187,7 @@ "Toque para obter mais opções." "Depuração USB ligada" "Toque para desativar a depuração USB." - "Seleccione para desativar depuração USB." + "Selecione para desativar a depuração por USB." "A criar relatório de erro…" "Pretende partilhar o relatório de erro?" "A partilhar relatório de erro…" @@ -1307,7 +1307,7 @@ "Sem correspondências" "Localizar na página" - %d of %d + 1 correspondência %d de %d "Concluído" @@ -1593,7 +1593,7 @@ "Os PINs não correspondem. Tente novamente." "O PIN é demasiado pequeno. Deve ter, no mínimo, 4 dígitos." - Try again in %d seconds + Tente novamente dentro de 1 segundo Tente novamente dentro de %d segundos "Tente novamente mais tarde" @@ -1626,35 +1626,35 @@ "Ativar a Poupança de dados?" "Ativar" - For %1$d minutes (until %2$s) - Durante %1$d minutos (até às %2$s) + Durante um minuto (até à(s) %2$s) + Durante %1$d minutos (até à(s) %2$s) - For %1$d min (until %2$s) - Durante %1$d min (até às %2$s) + Durante 1 min (até à(s) %2$s) + Durante %1$d min (até à(s) %2$s) - For %1$d hours (until %2$s) - Durante %1$d horas (até às %2$s) + Durante uma hora (até à(s) %2$s) + Durante %1$d horas (até à(s) %2$s) - For %1$d hr (until %2$s) - Durante %1$d h (até às %2$s) + Durante 1 h (até à(s) %2$s) + Durante %1$d h (até à(s) %2$s) - For %d minutes + Durante um minuto Durante %d minutos - For %d min + Durante 1 min Durante %d min - For %d hours + Durante uma hora Durante %d horas - For %d hr + Durante 1 h Durante %d h "Até às %1$s" @@ -1690,7 +1690,7 @@ "Fechar" "%1$s: %2$s" - %1$d selected + %1$d selecionado %1$d selecionados "Sem categoria" @@ -1754,7 +1754,7 @@ "Não é possível preencher automaticamente o conteúdo" "Sem sugestões do preenchimento automático" - %1$s autofill suggestions + Uma sugestão do preenchimento automático %1$s sugestões do preenchimento automático "Pretende guardar no <b>%1$s</b>?" From debdb691e4eff7a550bf76b65f20fee50cb58c8d Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 26 Jul 2017 10:49:37 -0700 Subject: [PATCH 12/16] Import translations. DO NOT MERGE Change-Id: I6ff93110716d74d81f968786a331295e110e0168 Auto-generated-cl: translation import Exempt-From-Owner-Approval: translation import --- packages/PrintSpooler/res/values-pt-rPT/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/PrintSpooler/res/values-pt-rPT/strings.xml b/packages/PrintSpooler/res/values-pt-rPT/strings.xml index 5da31bde591a4..eac6d36164da8 100644 --- a/packages/PrintSpooler/res/values-pt-rPT/strings.xml +++ b/packages/PrintSpooler/res/values-pt-rPT/strings.xml @@ -56,8 +56,8 @@ "Selecionar impressora" "Esquecer impressora" - %1$s impressoras encontradas %1$s impressora encontrada + %1$s impressoras encontradas "%1$s – %2$s" "Mais informações acerca desta impressora" @@ -76,8 +76,8 @@ "Serviços desativados" "Todos os serviços" - Instale para detetar %1$s impressoras Instale para detetar %1$s impressora + Instale para detetar %1$s impressoras "A imprimir %1$s" "A cancelar %1$s" From 280ae44b14171e426e3a6d3691babb0bcaa74e80 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 26 Jul 2017 10:54:37 -0700 Subject: [PATCH 13/16] Import translations. DO NOT MERGE Change-Id: Ib4dc70583403c24fd26d0e909577e13c22165482 Auto-generated-cl: translation import Exempt-From-Owner-Approval: translation import --- .../SystemUI/res-keyguard/values-pt-rPT/strings.xml | 10 +++++----- packages/SystemUI/res/values-pt-rBR/strings.xml | 8 ++++---- packages/SystemUI/res/values-pt-rPT/strings.xml | 12 ++++++------ packages/SystemUI/res/values-pt-rPT/strings_tv.xml | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml b/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml index 7e208c2174011..871d2cf9c6629 100644 --- a/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml +++ b/packages/SystemUI/res-keyguard/values-pt-rPT/strings.xml @@ -91,12 +91,12 @@ "Desenhou a sequência de desbloqueio incorretamente %1$d vezes. Após mais %2$d tentativas sem êxito, ser-lhe-á pedido para desbloquear o telemóvel através de uma conta de email.\n\n Tente novamente dentro de %3$d segundos." "Código PIN do cartão SIM incorreto. Tem de contactar o seu operador para desbloquear o dispositivo." - Incorrect SIM PIN code, you have %d remaining attempts. + Código PIN do cartão SIM incorreto. Tem mais %d tentativa antes de precisar de contactar o seu operador para desbloquear o dispositivo. Código PIN do cartão SIM incorreto. Tem mais %d tentativas. "Cartão SIM inutilizável. Contacte o seu operador." - Incorrect SIM PUK code, you have %d remaining attempts before SIM becomes permanently unusable. + Código PUK do cartão SIM incorreto. Tem mais %d tentativa antes de o cartão SIM ficar permanentemente inutilizável. Código PUK do cartão SIM incorreto. Tem mais %d tentativas antes de o cartão SIM ficar permanentemente inutilizável. "Falha ao introduzir o PIN do cartão SIM!" @@ -117,15 +117,15 @@ "Dispositivo bloqueado pelo administrador" "O dispositivo foi bloqueado manualmente" - Device hasn\'t been unlocked for %d hours. Confirm pattern. + O dispositivo não é desbloqueado há %d hora. Confirme o padrão. O dispositivo não é desbloqueado há %d horas. Confirme o padrão. - Device hasn\'t been unlocked for %d hours. Confirm PIN. + O dispositivo não é desbloqueado há %d hora. Confirme o PIN. O dispositivo não é desbloqueado há %d horas. Confirme o PIN. - Device hasn\'t been unlocked for %d hours. Confirm password. + O dispositivo não é desbloqueado há %d hora. Confirme a palavra-passe. O dispositivo não é desbloqueado há %d horas. Confirme a palavra-passe. "Não reconhecido" diff --git a/packages/SystemUI/res/values-pt-rBR/strings.xml b/packages/SystemUI/res/values-pt-rBR/strings.xml index 7cd023cd39d79..a8bdd9191760e 100644 --- a/packages/SystemUI/res/values-pt-rBR/strings.xml +++ b/packages/SystemUI/res/values-pt-rBR/strings.xml @@ -214,10 +214,10 @@ "Bluetooth conectado." "O Bluetooth foi desativado." "O Bluetooth foi ativado." - "Relatório de Localização desativado." - "Relatório de Localização ativado." - "O Relatório de Localização foi desativado." - "O Relatório de Localização foi ativado." + "Relatório de localização desativado." + "Relatório de localização ativado." + "O Relatório de localização foi desativado." + "O Relatório de localização foi ativado." "Alarme definido para %s." "Fechar painel." "Mais tempo." diff --git a/packages/SystemUI/res/values-pt-rPT/strings.xml b/packages/SystemUI/res/values-pt-rPT/strings.xml index fe0859ef4b9ce..65b130b3c62f6 100644 --- a/packages/SystemUI/res/values-pt-rPT/strings.xml +++ b/packages/SystemUI/res/values-pt-rPT/strings.xml @@ -26,7 +26,7 @@ "Os ecrãs recentes aparecem aqui" "Ignorar aplicações recentes" - %d screens in Overview + 1 ecrã na Vista geral %d ecrãs na Vista geral "Sem notificações" @@ -252,7 +252,7 @@ "Limpar todas as notificações." "+ %s" - %s more notifications inside. + Mais %s notificação no grupo. Mais %s notificações no grupo. "Definições de notificação" @@ -552,12 +552,12 @@ "%d categorias de notificação" "Esta aplicação não tem categorias de notificação" - 1 out of %d notification categories from this app + 1 de %d categoria de notificação desta aplicação 1 de %d categorias de notificação desta aplicação "%1$s, %2$s" - %1$s, %2$s, and %3$d others + %1$s, %2$s e mais %3$d %1$s, %2$s e mais %3$d "Controlos de notificações da aplicação %1$s abertos" @@ -718,8 +718,8 @@ "Minimizar" "Fechar" "Arrastar para baixo para ignorar" - "Menu de imagem na imagem" - "A aplicação %s está no modo de imagem na imagem" + "Menu de ecrã no ecrã" + "A aplicação %s está no modo de ecrã no ecrã" "Se não pretende que a aplicação %s utilize esta funcionalidade, toque para abrir as definições e desative-a." "Reproduzir" "Colocar em pausa" diff --git a/packages/SystemUI/res/values-pt-rPT/strings_tv.xml b/packages/SystemUI/res/values-pt-rPT/strings_tv.xml index a621877ef317d..ee90009d3dc29 100644 --- a/packages/SystemUI/res/values-pt-rPT/strings_tv.xml +++ b/packages/SystemUI/res/values-pt-rPT/strings_tv.xml @@ -19,7 +19,7 @@ - "Imagem na imagem" + "Ecrã no ecrã" "(Sem título do programa)" "Fechar PIP" "Ecrã inteiro" From 9c1d56576e01060f40de74a4c0e35e95064351be Mon Sep 17 00:00:00 2001 From: Michael Plass Date: Thu, 13 Jul 2017 10:09:07 -0700 Subject: [PATCH 14/16] [AsyncChannel] Fix race in handling of sync result Bug: 62866191 Bug: 63074860 Test: wifi unit tests Change-Id: I1d59eb8d599de9d9041e0b9b7d731363675a40c9 (cherry picked from commit 56e46134d364f7f293158979765336721a6c752c) --- .../android/internal/util/AsyncChannel.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/core/java/com/android/internal/util/AsyncChannel.java b/core/java/com/android/internal/util/AsyncChannel.java index d8be9fdc33bda..6fbfff8f381dd 100644 --- a/core/java/com/android/internal/util/AsyncChannel.java +++ b/core/java/com/android/internal/util/AsyncChannel.java @@ -768,9 +768,10 @@ public class AsyncChannel { /** Handle of the reply message */ @Override public void handleMessage(Message msg) { - mResultMsg = Message.obtain(); - mResultMsg.copyFrom(msg); + Message msgCopy = Message.obtain(); + msgCopy.copyFrom(msg); synchronized(mLockObject) { + mResultMsg = msgCopy; mLockObject.notify(); } } @@ -812,22 +813,26 @@ public class AsyncChannel { */ private static Message sendMessageSynchronously(Messenger dstMessenger, Message msg) { SyncMessenger sm = SyncMessenger.obtain(); + Message resultMsg = null; try { if (dstMessenger != null && msg != null) { msg.replyTo = sm.mMessenger; synchronized (sm.mHandler.mLockObject) { + if (sm.mHandler.mResultMsg != null) { + Slog.wtf(TAG, "mResultMsg should be null here"); + sm.mHandler.mResultMsg = null; + } dstMessenger.send(msg); sm.mHandler.mLockObject.wait(); + resultMsg = sm.mHandler.mResultMsg; + sm.mHandler.mResultMsg = null; } - } else { - sm.mHandler.mResultMsg = null; } } catch (InterruptedException e) { - sm.mHandler.mResultMsg = null; + Slog.e(TAG, "error in sendMessageSynchronously", e); } catch (RemoteException e) { - sm.mHandler.mResultMsg = null; + Slog.e(TAG, "error in sendMessageSynchronously", e); } - Message resultMsg = sm.mHandler.mResultMsg; sm.recycle(); return resultMsg; } From d788e9420c392d868a0c43ae8df8039b92ddd23e Mon Sep 17 00:00:00 2001 From: Erik Wolsheimer Date: Fri, 28 Jul 2017 14:02:46 -0700 Subject: [PATCH 15/16] DO NOT MERGE JobInfo experiment Bug: 28696194 Change-Id: I26c5ae4a16109d5febd6e80459801ba97b3adfb1 --- core/java/android/app/job/JobInfo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/job/JobInfo.java b/core/java/android/app/job/JobInfo.java index 87e516cabba54..b304d07db22c4 100644 --- a/core/java/android/app/job/JobInfo.java +++ b/core/java/android/app/job/JobInfo.java @@ -107,10 +107,10 @@ public class JobInfo implements Parcelable { public static final int BACKOFF_POLICY_EXPONENTIAL = 1; /* Minimum interval for a periodic job, in milliseconds. */ - private static final long MIN_PERIOD_MILLIS = 15 * 60 * 1000L; // 15 minutes + private static final long MIN_PERIOD_MILLIS = 30 * 60 * 1000L; // HACK|STOPSHIP:ewol 30 minutes /* Minimum flex for a periodic job, in milliseconds. */ - private static final long MIN_FLEX_MILLIS = 5 * 60 * 1000L; // 5 minutes + private static final long MIN_FLEX_MILLIS = 10 * 60 * 1000L; // HACK|STOPSHIP:ewol 10 minutes /** * Minimum backoff interval for a job, in milliseconds From 2504ebf600738cd46565174732dd0b1041b61d27 Mon Sep 17 00:00:00 2001 From: Tyler Freeman Date: Wed, 9 Aug 2017 13:55:44 -0700 Subject: [PATCH 16/16] Remove gender-specific pronouns from documentation Bug: 64847340 Change-Id: Ifc48cebbab8ad1d7223d75637eb63049bc28ae7c --- core/java/android/view/View.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 25c02d17f046c..7eebbbdf9e079 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -25697,10 +25697,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * version supported by the application. For example, the method * {@link View#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)} is not available * in API version 4 when the accessibility APIs were first introduced. If a - * developer would like his application to run on API version 4 devices (assuming + * developer would like their application to run on API version 4 devices (assuming * all other APIs used by the application are version 4 or lower) and take advantage * of this method, instead of overriding the method which would break the application's - * backwards compatibility, he can override the corresponding method in this + * backwards compatibility, they can override the corresponding method in this * delegate and register the delegate in the target View if the API version of * the system is high enough, i.e. the API version is the same as or higher than the API * version that introduced