diff options
18 files changed, 348 insertions, 73 deletions
diff --git a/core/java/android/hardware/ICameraServiceProxy.aidl b/core/java/android/hardware/ICameraServiceProxy.aidl index 0bb24bc..0e654d5 100644 --- a/core/java/android/hardware/ICameraServiceProxy.aidl +++ b/core/java/android/hardware/ICameraServiceProxy.aidl @@ -19,6 +19,8 @@ package android.hardware; /** * Binder interface for the camera service proxy running in system_server. * + * Keep in sync with frameworks/av/include/camera/ICameraServiceProxy.h + * * @hide */ interface ICameraServiceProxy @@ -27,4 +29,9 @@ interface ICameraServiceProxy * Ping the service proxy to update the valid users for the camera service. */ oneway void pingForUserUpdate(); + + /** + * Update the status of a camera device + */ + oneway void notifyCameraState(String cameraId, int newCameraState); } diff --git a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java index e71e49f..b8d6960 100644 --- a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java +++ b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java @@ -1290,7 +1290,7 @@ public final class StreamConfigurationMap { for (StreamConfiguration config : configurations) { int fmt = config.getFormat(); if (fmt == format && config.isOutput() == output) { - if (output) { + if (output && mListHighResolution) { // Filter slow high-res output formats; include for // highRes, remove for !highRes long duration = 0; diff --git a/core/res/res/values-mcc219-mnc02/config.xml b/core/res/res/values-mcc219-mnc02/config.xml new file mode 100644 index 0000000..2ac6ba6 --- /dev/null +++ b/core/res/res/values-mcc219-mnc02/config.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2015, 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 my 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. +*/ +--> + +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Don't use roaming icon for considered operators --> + <string-array translatable="false" name="config_operatorConsideredNonRoaming"> + <item>21901</item> + </string-array> +</resources> diff --git a/core/res/res/values-watch/strings.xml b/core/res/res/values-watch/strings.xml index 4ea2b52..e5991fc 100644 --- a/core/res/res/values-watch/strings.xml +++ b/core/res/res/values-watch/strings.xml @@ -23,4 +23,50 @@ <string name="android_upgrading_apk">App <xliff:g id="number" example="123">%1$d</xliff:g> of <xliff:g id="number" example="123">%2$d</xliff:g>.</string> + + <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. Override from base which says "Body Sensors". [CHAR_LIMIT=25] --> + <string name="permgrouplab_sensors">Sensors</string> + + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_contactswear">access your contacts</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_locationwear">access this watch\'s location</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_calendarwear">access your calendar</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_smswear">send and view SMS messages</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_storagewear">access photos, media, and files on your watch</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_microphonewear">record audio</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_camerawear">take pictures and record video</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_phonewear">make and manage phone calls</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permgrouplab_sensorswear">access sensor data about your vital signs</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_statusBarServicewear">be the status bar</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_bodySensorswear">access body sensors (like heart rate monitors)</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_accessFineLocationwear">access precise location (GPS and network-based)</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_accessCoarseLocationwear">access approximate location (network-based)</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_sim_communicationwear">send commands to the SIM</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_createNetworkSocketswear">have full network access</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_manageProfileAndDeviceOwnerswear">manage profile and device owners</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_changeWimaxStatewear">change WiMAX state</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_handoverStatuswear">receive Android Beam transfer status</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_route_media_outputwear">route media output</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_readInstallSessionswear">read install sessions</string> + <!-- Description of a permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=100] --> + <string name="permlab_requestInstallPackageswear">request install packages</string> </resources> diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd index b57e6a7..39822e5 100644 --- a/docs/html/sdk/index.jd +++ b/docs/html/sdk/index.jd @@ -5,28 +5,28 @@ page.image=images/cards/android-studio_2x.png header.hide=1 page.metaDescription=Download the official Android IDE and developer tools to build apps for Android phones, tablets, wearables, TVs, and more. -studio.version=1.3.1.0 +studio.version=1.3.2.0 -studio.linux_bundle_download=android-studio-ide-141.2135290-linux.zip -studio.linux_bundle_bytes=351992670 -studio.linux_bundle_checksum=51e5f5de2b82883d87f85ee38cf7b7b8b2e7debf +studio.linux_bundle_download=android-studio-ide-141.2178183-linux.zip +studio.linux_bundle_bytes=352010593 +studio.linux_bundle_checksum=cf780413f8c8223eb348bd27c19a9c04b75eaeb2 -studio.mac_bundle_download=android-studio-ide-141.2135290-mac.dmg -studio.mac_bundle_bytes=368321249 -studio.mac_bundle_checksum=9fc12b5657ff52c761b7e7c115feade2a9728386 +studio.mac_bundle_download=android-studio-ide-141.2178183-mac.dmg +studio.mac_bundle_bytes=368335367 +studio.mac_bundle_checksum=75b67eb15a34a152a40e7189484ab0ebc375b877 -studio.win_bundle_download=android-studio-ide-141.2135290-windows.zip -studio.win_bundle_bytes=344406793 -studio.win_bundle_checksum=3b4c4924cb9495e56db61ca0e8c8d2bf588c4b97 +studio.win_bundle_download=android-studio-ide-141.2178183-windows.zip +studio.win_bundle_bytes=344424713 +studio.win_bundle_checksum=3134f226b5f3c3f74d4fc2d9cff03a4458f01d69 -studio.win_bundle_exe_download=android-studio-bundle-141.2135290-windows.exe -studio.win_bundle_exe_bytes=1008506096 -studio.win_bundle_exe_checksum=8cff590f2e08e339f8c2491b287a840ae87c7383 +studio.win_bundle_exe_download=android-studio-bundle-141.2178183-windows.exe +studio.win_bundle_exe_bytes=1136982712 +studio.win_bundle_exe_checksum=c7d39c529dd434489da9d086ff689d34dc791526 -studio.win_notools_exe_download=android-studio-ide-141.2135290-windows.exe -studio.win_notools_exe_bytes=321791312 -studio.win_notools_exe_checksum=d70fb49d03db9dded19c891a92452601e39272f4 +studio.win_notools_exe_download=android-studio-ide-141.2178183-windows.exe +studio.win_notools_exe_bytes=321810248 +studio.win_notools_exe_checksum=b5d1aaa000729c03a3cf980add79d1b93121c56d diff --git a/docs/html/tools/revisions/studio.jd b/docs/html/tools/revisions/studio.jd index c922b28..298b173 100644 --- a/docs/html/tools/revisions/studio.jd +++ b/docs/html/tools/revisions/studio.jd @@ -43,6 +43,29 @@ Android Studio, as denoted by revision number. </p> <div class="toggle-content opened"> <p><a href="#" onclick="return toggleContent(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" + alt=""/>Android Studio v1.3.2</a> <em>(August 2015)</em> + </p> + <div class="toggle-content-toggleme"> + <p>Fixes and enhancements:</p> + <ul> + <li>Added support for Android 6.0 (API level 23), including new icons and AVD Manager + support for creating devices with new screen densities.</li> + <li>Fixed an exception that was occuring during update checks. + <a href="http://b.android.com/183068">Issue: 183068</a></li> + <li>Fixed problem where unresolved view coordinates could cause the layout editor to crash. + <a href="http://b.android.com/178690">Issue: 178690</a></li> + <li>Fixed issue with invalid resource type warnings. + <a href="http://b.android.com/182433">Issue: 182433</a></li> + <li>Fixed lint check that was incorrectly flagging resources as private. + <a href="http://b.android.com/183120">Issue: 183120</a></li> + </ul> + </div> +</div> + + +<div class="toggle-content closed"> + <p><a href="#" onclick="return toggleContent(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt=""/>Android Studio v1.3.1</a> <em>(August 2015)</em> </p> <div class="toggle-content-toggleme"> @@ -60,8 +83,6 @@ Android Studio, as denoted by revision number. </p> </div> - - <div class="toggle-content closed"> <p><a href="#" onclick="return toggleContent(this)"> <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" @@ -100,7 +121,7 @@ Android Studio, as denoted by revision number. </p> <li>Added <a href="{@docRoot}tools/data-binding/guide.html">data binding</a> support to create declarative layouts that bind your application logic to layout elements. </li> <li>Added support for a separate - <a href="{@docRoot}tools/studio/studio-features.html#test-module">test APK module</a> + <a href="{@docRoot}tools/studio/studio-features.html#test-module">test APK module</a> to build test APKs in Android Studio. </li> <li>Updated the <a href="{@docRoot}tools/help/avd-manager.html">AVD Manager</a> with HAXM optimizations and improved notifications. </li> diff --git a/docs/html/tools/sdk/eclipse-adt.jd b/docs/html/tools/sdk/eclipse-adt.jd index 08634da..3c12a64 100644 --- a/docs/html/tools/sdk/eclipse-adt.jd +++ b/docs/html/tools/sdk/eclipse-adt.jd @@ -53,6 +53,39 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues <div class="toggle-content opened"> <p><a href="#" onclick="return toggleContent(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" + alt=""/>ADT 23.0.7</a> <em>(August 2015)</em> + </p> + + <div class="toggle-content-toggleme"> +<dl> + <dt>Dependencies:</dt> + + <dd> + <ul> + <li>Java 7 or higher is required if you are targeting Android 5.0 and higher.</li> + <li>Java 1.6 or higher is required if you are targeting other releases.</li> + <li>Eclipse Indigo (Version 3.7.2) or higher is required.</li> + <li>This version of ADT is designed for use with + <a href="{@docRoot}tools/sdk/tools-notes.html">SDK Tools r24.1.2</a>. + If you haven't already installed SDK Tools r24.1.2 into your SDK, use the + Android SDK Manager to do so.</li> + </ul> + </dd> + + <dt>General Notes:</dt> + <dd> + <ul> + <li>Fixed issues with the rendering library for the visual layout editor.</li> + </ul> + </dd> +</dl> +</div> +</div> + + +<div class="toggle-content closed"> + <p><a href="#" onclick="return toggleContent(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt=""/>ADT 23.0.6</a> <em>(March 2015)</em> </p> @@ -75,7 +108,7 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues <dt>General Notes:</dt> <dd> <ul> - <li>Fixed issues with the rendering library.</li> + <li>Fixed issues with the rendering library for the visual layout editor.</li> </ul> </dd> </dl> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java index 28d4a42..4e69999 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java @@ -183,8 +183,11 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { mStatusBarKeyguardViewManager.animateCollapsePanels( FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR); break; - case MODE_WAKE_AND_UNLOCK: case MODE_WAKE_AND_UNLOCK_PULSING: + mPhoneStatusBar.updateMediaMetaData(false /* metaDataChanged */); + // Fall through. + case MODE_WAKE_AND_UNLOCK: + mStatusBarWindowManager.setStatusBarFocusable(false); mDozeScrimController.abortPulsing(); mKeyguardViewMediator.onWakeAndUnlocking(); mScrimController.setWakeAndUnlocking(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 649dad3..d5825de 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1694,7 +1694,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, final boolean hasArtwork = artworkBitmap != null; if ((hasArtwork || DEBUG_MEDIA_FAKE_ARTWORK) - && (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED)) { + && (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) + && mFingerprintUnlockController.getMode() + != FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING) { // time to show some art! if (mBackdrop.getVisibility() != View.VISIBLE) { mBackdrop.setVisibility(View.VISIBLE); @@ -1749,31 +1751,40 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (DEBUG_MEDIA) { Log.v(TAG, "DEBUG_MEDIA: Fading out album artwork"); } - mBackdrop.animate() - // Never let the alpha become zero - otherwise the RenderNode - // won't draw anything and uninitialized memory will show through - // if mScrimSrcModeEnabled. Note that 0.001 is rounded down to 0 in libhwui. - .alpha(0.002f) - .setInterpolator(mBackdropInterpolator) - .setDuration(300) - .setStartDelay(0) - .withEndAction(new Runnable() { - @Override - public void run() { - mBackdrop.setVisibility(View.GONE); - mBackdropFront.animate().cancel(); - mBackdropBack.animate().cancel(); - mHandler.post(mHideBackdropFront); - } - }); - if (mKeyguardFadingAway) { - mBackdrop.animate() + if (mFingerprintUnlockController.getMode() + == FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING) { - // Make it disappear faster, as the focus should be on the activity behind. - .setDuration(mKeyguardFadingAwayDuration / 2) - .setStartDelay(mKeyguardFadingAwayDelay) - .setInterpolator(mLinearInterpolator) - .start(); + // We are unlocking directly - no animation! + mBackdrop.setVisibility(View.GONE); + } else { + mBackdrop.animate() + // Never let the alpha become zero - otherwise the RenderNode + // won't draw anything and uninitialized memory will show through + // if mScrimSrcModeEnabled. Note that 0.001 is rounded down to 0 in + // libhwui. + .alpha(0.002f) + .setInterpolator(mBackdropInterpolator) + .setDuration(300) + .setStartDelay(0) + .withEndAction(new Runnable() { + @Override + public void run() { + mBackdrop.setVisibility(View.GONE); + mBackdropFront.animate().cancel(); + mBackdropBack.animate().cancel(); + mHandler.post(mHideBackdropFront); + } + }); + if (mKeyguardFadingAway) { + mBackdrop.animate() + + // Make it disappear faster, as the focus should be on the activity + // behind. + .setDuration(mKeyguardFadingAwayDuration / 2) + .setStartDelay(mKeyguardFadingAwayDelay) + .setInterpolator(mLinearInterpolator) + .start(); + } } } } @@ -2436,8 +2447,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, || mStatusBarMode == MODE_LIGHTS_OUT_TRANSPARENT); boolean allowLight = isTransparentBar && !mBatteryController.isPowerSave(); boolean light = (vis & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0; - - mIconController.setIconsDark(allowLight && light); + boolean animate = mFingerprintUnlockController == null + || (mFingerprintUnlockController.getMode() + != FingerprintUnlockController.MODE_WAKE_AND_UNLOCK_PULSING + && mFingerprintUnlockController.getMode() + != FingerprintUnlockController.MODE_WAKE_AND_UNLOCK); + mIconController.setIconsDark(allowLight && light, animate); } // restore the recents bit if (wasRecentsVisible) { @@ -4029,8 +4044,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public void appTransitionStarting(long startTime, long duration) { // Use own timings when Keyguard is going away, see keyguardGoingAway and - // setKeyguardFadingAway - if (!mKeyguardFadingAway) { + // setKeyguardFadingAway. When duration is 0, skip this one because no animation is really + // playing. + if (!mKeyguardFadingAway && duration > 0) { mIconController.appTransitionStarting(startTime, duration); } if (mIconPolicy != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java index 067e50e..5de1c13 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java @@ -335,8 +335,10 @@ public class StatusBarIconController implements Tunable { } } - public void setIconsDark(boolean dark) { - if (mTransitionPending) { + public void setIconsDark(boolean dark, boolean animate) { + if (!animate) { + setIconTintInternal(dark ? 1.0f : 0.0f); + } else if (mTransitionPending) { deferIconTintChange(dark ? 1.0f : 0.0f); } else if (mTransitionDeferring) { animateIconTint(dark ? 1.0f : 0.0f, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index 82064a7..cf696a1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -127,7 +127,7 @@ public class StackScrollAlgorithm { mCollapseSecondCardPadding = context.getResources().getDimensionPixelSize( R.dimen.notification_collapse_second_card_padding); mScaleDimmed = context.getResources().getDisplayMetrics().densityDpi - >= DisplayMetrics.DENSITY_XXHIGH; + >= DisplayMetrics.DENSITY_420; } public boolean shouldScaleDimmed() { diff --git a/services/core/java/com/android/server/camera/CameraService.java b/services/core/java/com/android/server/camera/CameraService.java index 0be24f4..f82454a 100644 --- a/services/core/java/com/android/server/camera/CameraService.java +++ b/services/core/java/com/android/server/camera/CameraService.java @@ -23,13 +23,17 @@ import android.content.IntentFilter; import android.content.pm.UserInfo; import android.hardware.ICameraService; import android.hardware.ICameraServiceProxy; +import android.nfc.INfcAdapter; import android.os.Handler; import android.os.IBinder; +import android.os.Binder; import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.os.UserManager; +import android.os.SystemProperties; import android.util.Slog; +import android.util.ArraySet; import com.android.server.ServiceThread; import com.android.server.SystemService; @@ -44,8 +48,10 @@ import java.util.Set; * * @hide */ -public class CameraService extends SystemService implements Handler.Callback { +public class CameraService extends SystemService + implements Handler.Callback, IBinder.DeathRecipient { private static final String TAG = "CameraService_proxy"; + private static final boolean DEBUG = false; /** * This must match the ICameraService.aidl definition @@ -58,6 +64,16 @@ public class CameraService extends SystemService implements Handler.Callback { public static final int NO_EVENT = 0; // NOOP public static final int USER_SWITCHED = 1; // User changed, argument is the new user handle + // State arguments to use with the notifyCameraState call from camera service: + public static final int CAMERA_STATE_OPEN = 0; + public static final int CAMERA_STATE_ACTIVE = 1; + public static final int CAMERA_STATE_IDLE = 2; + public static final int CAMERA_STATE_CLOSED = 3; + + // Flags arguments to NFC adapter to enable/disable NFC + public static final int DISABLE_POLLING_FLAGS = 0x1000; + public static final int ENABLE_POLLING_FLAGS = 0x0000; + // Handler message codes private static final int MSG_SWITCH_USER = 1; @@ -72,6 +88,17 @@ public class CameraService extends SystemService implements Handler.Callback { private Set<Integer> mEnabledCameraUsers; private int mLastUser; + private ICameraService mCameraServiceRaw; + + private final ArraySet<String> mActiveCameraIds = new ArraySet<>(); + + private static final String NFC_NOTIFICATION_PROP = "ro.camera.notify_nfc"; + private static final String NFC_SERVICE_BINDER_NAME = "nfc"; + private static final IBinder nfcInterfaceToken = new Binder(); + + private final boolean mNotifyNfc; + private int mActiveCameraCount = 0; + private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -102,6 +129,14 @@ public class CameraService extends SystemService implements Handler.Callback { public void pingForUserUpdate() { notifySwitchWithRetries(30); } + + @Override + public void notifyCameraState(String cameraId, int newCameraState) { + String state = cameraStateToString(newCameraState); + if (DEBUG) Slog.v(TAG, "Camera " + cameraId + " state now " + state); + + updateActivityCount(cameraId, newCameraState); + } }; public CameraService(Context context) { @@ -110,6 +145,9 @@ public class CameraService extends SystemService implements Handler.Callback { mHandlerThread = new ServiceThread(TAG, Process.THREAD_PRIORITY_DISPLAY, /*allowTo*/false); mHandlerThread.start(); mHandler = new Handler(mHandlerThread.getLooper(), this); + + mNotifyNfc = SystemProperties.getInt(NFC_NOTIFICATION_PROP, 0) > 0; + if (DEBUG) Slog.v(TAG, "Notify NFC behavior is " + (mNotifyNfc ? "active" : "disabled")); } @Override @@ -161,13 +199,32 @@ public class CameraService extends SystemService implements Handler.Callback { } } + /** + * Handle the death of the native camera service + */ + @Override + public void binderDied() { + if (DEBUG) Slog.w(TAG, "Native camera service has died"); + synchronized(mLock) { + mCameraServiceRaw = null; + + // All cameras reset to idle on camera service death + boolean wasEmpty = mActiveCameraIds.isEmpty(); + mActiveCameraIds.clear(); + + if ( mNotifyNfc && !wasEmpty ) { + notifyNfcService(/*enablePolling*/ true); + } + } + } + private void switchUserLocked(int userHandle) { Set<Integer> currentUserHandles = getEnabledUserHandles(userHandle); mLastUser = userHandle; if (mEnabledCameraUsers == null || !mEnabledCameraUsers.equals(currentUserHandles)) { // Some user handles have been added or removed, update mediaserver. mEnabledCameraUsers = currentUserHandles; - notifyMediaserver(USER_SWITCHED, currentUserHandles); + notifyMediaserverLocked(USER_SWITCHED, currentUserHandles); } } @@ -187,7 +244,7 @@ public class CameraService extends SystemService implements Handler.Callback { if (mEnabledCameraUsers == null) { return; } - if (notifyMediaserver(USER_SWITCHED, mEnabledCameraUsers)) { + if (notifyMediaserverLocked(USER_SWITCHED, mEnabledCameraUsers)) { retries = 0; } } @@ -199,19 +256,27 @@ public class CameraService extends SystemService implements Handler.Callback { RETRY_DELAY_TIME); } - private boolean notifyMediaserver(int eventType, Set<Integer> updatedUserHandles) { + private boolean notifyMediaserverLocked(int eventType, Set<Integer> updatedUserHandles) { // Forward the user switch event to the native camera service running in the mediaserver // process. - IBinder cameraServiceBinder = getBinderService(CAMERA_SERVICE_BINDER_NAME); - if (cameraServiceBinder == null) { - Slog.w(TAG, "Could not notify mediaserver, camera service not available."); - return false; // Camera service not active, cannot evict user clients. - } + if (mCameraServiceRaw == null) { + IBinder cameraServiceBinder = getBinderService(CAMERA_SERVICE_BINDER_NAME); + if (cameraServiceBinder == null) { + Slog.w(TAG, "Could not notify mediaserver, camera service not available."); + return false; // Camera service not active, cannot evict user clients. + } + try { + cameraServiceBinder.linkToDeath(this, /*flags*/ 0); + } catch (RemoteException e) { + Slog.w(TAG, "Could not link to death of native camera service"); + return false; + } - ICameraService cameraServiceRaw = ICameraService.Stub.asInterface(cameraServiceBinder); + mCameraServiceRaw = ICameraService.Stub.asInterface(cameraServiceBinder); + } try { - cameraServiceRaw.notifySystemEvent(eventType, toArray(updatedUserHandles)); + mCameraServiceRaw.notifySystemEvent(eventType, toArray(updatedUserHandles)); } catch (RemoteException e) { Slog.w(TAG, "Could not notify mediaserver, remote exception: " + e); // Not much we can do if camera service is dead. @@ -220,6 +285,44 @@ public class CameraService extends SystemService implements Handler.Callback { return true; } + private void updateActivityCount(String cameraId, int newCameraState) { + synchronized(mLock) { + boolean wasEmpty = mActiveCameraIds.isEmpty(); + switch (newCameraState) { + case CAMERA_STATE_OPEN: + break; + case CAMERA_STATE_ACTIVE: + mActiveCameraIds.add(cameraId); + break; + case CAMERA_STATE_IDLE: + case CAMERA_STATE_CLOSED: + mActiveCameraIds.remove(cameraId); + break; + } + boolean isEmpty = mActiveCameraIds.isEmpty(); + if ( mNotifyNfc && (wasEmpty != isEmpty) ) { + notifyNfcService(isEmpty); + } + } + } + + private void notifyNfcService(boolean enablePolling) { + + IBinder nfcServiceBinder = getBinderService(NFC_SERVICE_BINDER_NAME); + if (nfcServiceBinder == null) { + Slog.w(TAG, "Could not connect to NFC service to notify it of camera state"); + return; + } + INfcAdapter nfcAdapterRaw = INfcAdapter.Stub.asInterface(nfcServiceBinder); + int flags = enablePolling ? ENABLE_POLLING_FLAGS : DISABLE_POLLING_FLAGS; + if (DEBUG) Slog.v(TAG, "Setting NFC reader mode to flags " + flags); + try { + nfcAdapterRaw.setReaderMode(nfcInterfaceToken, null, flags, null); + } catch (RemoteException e) { + Slog.w(TAG, "Could not notify NFC service, remote exception: " + e); + } + } + private static int[] toArray(Collection<Integer> c) { int len = c.size(); int[] ret = new int[len]; @@ -229,4 +332,15 @@ public class CameraService extends SystemService implements Handler.Callback { } return ret; } + + private static String cameraStateToString(int newCameraState) { + switch (newCameraState) { + case CAMERA_STATE_OPEN: return "CAMERA_STATE_OPEN"; + case CAMERA_STATE_ACTIVE: return "CAMERA_STATE_ACTIVE"; + case CAMERA_STATE_IDLE: return "CAMERA_STATE_IDLE"; + case CAMERA_STATE_CLOSED: return "CAMERA_STATE_CLOSED"; + default: break; + } + return "CAMERA_STATE_UNKNOWN"; + } } diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index befa311..932662f 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -764,6 +764,7 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe mHandler.post(new Runnable() { @Override public void run() { + MetricsLogger.histogram(mContext, "fingerprint_token", opId != 0L ? 1 : 0); startAuthentication(token, opId, effectiveGroupId, receiver, flags, restricted); } }); diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 4bb3c1a..e1bd9f9 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -4626,7 +4626,7 @@ public class PackageManagerService extends IPackageManager.Stub { if (result == null) { result = new CrossProfileDomainInfo(); result.resolveInfo = - createForwardingResolveInfo(null, sourceUserId, parentUserId); + createForwardingResolveInfo(new IntentFilter(), sourceUserId, parentUserId); result.bestDomainVerificationStatus = status; } else { result.bestDomainVerificationStatus = bestDomainVerificationStatus(status, diff --git a/services/core/java/com/android/server/policy/StatusBarController.java b/services/core/java/com/android/server/policy/StatusBarController.java index d1b50da..b1ae922 100644 --- a/services/core/java/com/android/server/policy/StatusBarController.java +++ b/services/core/java/com/android/server/policy/StatusBarController.java @@ -72,7 +72,9 @@ public class StatusBarController extends BarController { if (statusbar != null) { long startTime = calculateStatusBarTransitionStartTime(openAnimation, closeAnimation); - statusbar.appTransitionStarting(startTime, TRANSITION_DURATION); + long duration = closeAnimation != null || openAnimation != null + ? TRANSITION_DURATION : 0; + statusbar.appTransitionStarting(startTime, duration); } } catch (RemoteException e) { Slog.e(mTag, "RemoteException when app transition is starting", e); diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index 794b49c..3da9b44 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -389,7 +389,9 @@ public class TaskStack { void resetAnimationBackgroundAnimator() { mAnimationBackgroundAnimator = null; - mAnimationBackgroundSurface.hide(); + if (mAnimationBackgroundSurface != null) { + mAnimationBackgroundSurface.hide(); + } } private long getDimBehindFadeDuration(long duration) { @@ -454,11 +456,14 @@ public class TaskStack { } boolean isDimming() { + if (mDimLayer == null) { + return false; + } return mDimLayer.isDimming(); } boolean isDimming(WindowStateAnimator winAnimator) { - return mDimWinAnimator == winAnimator && mDimLayer.isDimming(); + return mDimWinAnimator == winAnimator && isDimming(); } void startDimmingIfNeeded(WindowStateAnimator newWinAnimator) { diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 2c02967..33d4331 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -10409,8 +10409,8 @@ public class WindowManagerService extends IWindowManager.Stub ": removed=" + win.mRemoved + " visible=" + win.isVisibleLw() + " mHasSurface=" + win.mHasSurface + " drawState=" + win.mWinAnimator.mDrawState); - if (win.mRemoved || !win.mHasSurface) { - // Window has been removed; no draw will now happen, so stop waiting. + if (win.mRemoved || !win.mHasSurface || !win.mPolicyVisibility) { + // Window has been removed or hidden; no draw will now happen, so stop waiting. if (DEBUG_SCREEN_ON) Slog.w(TAG, "Aborted waiting for drawn: " + win); mWaitingForDrawn.remove(win); } else if (win.hasDrawnLw()) { diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index ab56d5e..726d29d 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1589,8 +1589,6 @@ class WindowStateAnimator { final int left = ((int) shownFrame.left) - attrs.surfaceInsets.left; final int top = ((int) shownFrame.top) - attrs.surfaceInsets.top; if (mSurfaceX != left || mSurfaceY != top) { - mSurfaceX = left; - mSurfaceY = top; if (mAnimating) { // If this window (or its app token) is animating, then the position // of the surface will be re-computed on the next animation frame. @@ -1598,6 +1596,8 @@ class WindowStateAnimator { // transformation is being applied by the animation. return; } + mSurfaceX = left; + mSurfaceY = top; if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setWallpaperOffset"); SurfaceControl.openTransaction(); try { |