diff options
Diffstat (limited to 'core')
55 files changed, 957 insertions, 737 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 41e3db8..cb1e7aa 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -31,6 +31,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.ComponentInfo; import android.content.pm.ContainerEncryptionParams; import android.content.pm.FeatureInfo; +import android.content.pm.IOnPermissionsChangeListener; import android.content.pm.IPackageDataObserver; import android.content.pm.IPackageDeleteObserver; import android.content.pm.IPackageInstallObserver; @@ -88,6 +89,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Objects; /*package*/ @@ -1048,6 +1050,38 @@ final class ApplicationPackageManager extends PackageManager { } } + @Override + public void addOnPermissionsChangeListener(OnPermissionsChangedListener listener) { + synchronized (mPermissionListeners) { + if (mPermissionListeners.get(listener) != null) { + return; + } + OnPermissionsChangeListenerDelegate delegate = + new OnPermissionsChangeListenerDelegate(listener, Looper.getMainLooper()); + try { + mPM.addOnPermissionsChangeListener(delegate); + mPermissionListeners.put(listener, delegate); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + } + } + + @Override + public void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener) { + synchronized (mPermissionListeners) { + IOnPermissionsChangeListener delegate = mPermissionListeners.get(listener); + if (delegate != null) { + try { + mPM.removeOnPermissionsChangeListener(delegate); + mPermissionListeners.remove(listener); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + } + } + } + static void configurationChanged() { synchronized (sSync) { sIconCache.clear(); @@ -2139,4 +2173,39 @@ final class ApplicationPackageManager extends PackageManager { = new ArrayMap<ResourceName, WeakReference<Drawable.ConstantState>>(); private static ArrayMap<ResourceName, WeakReference<CharSequence>> sStringCache = new ArrayMap<ResourceName, WeakReference<CharSequence>>(); + + private final Map<OnPermissionsChangedListener, IOnPermissionsChangeListener> + mPermissionListeners = new ArrayMap<>(); + + public class OnPermissionsChangeListenerDelegate extends IOnPermissionsChangeListener.Stub + implements Handler.Callback{ + private static final int MSG_PERMISSIONS_CHANGED = 1; + + private final OnPermissionsChangedListener mListener; + private final Handler mHandler; + + + public OnPermissionsChangeListenerDelegate(OnPermissionsChangedListener listener, + Looper looper) { + mListener = listener; + mHandler = new Handler(looper, this); + } + + @Override + public void onPermissionsChanged(int uid) { + mHandler.obtainMessage(MSG_PERMISSIONS_CHANGED, uid, 0).sendToTarget(); + } + + @Override + public boolean handleMessage(Message msg) { + switch (msg.what) { + case MSG_PERMISSIONS_CHANGED: { + final int uid = msg.arg1; + mListener.onPermissionsChanged(uid); + return true; + } + } + return false; + } + } } diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 3ab0e01..bf44746 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -2275,7 +2275,7 @@ public class DevicePolicyManager { if (mService != null) { try { final String alias = getCaCertAlias(certBuffer); - mService.uninstallCaCert(admin, alias); + mService.uninstallCaCerts(admin, new String[] {alias}); } catch (CertificateException e) { Log.w(TAG, "Unable to parse certificate", e); } catch (RemoteException e) { @@ -2322,12 +2322,11 @@ public class DevicePolicyManager { */ public void uninstallAllUserCaCerts(@Nullable ComponentName admin) { if (mService != null) { - for (String alias : new TrustedCertificateStore().userAliases()) { - try { - mService.uninstallCaCert(admin, alias); - } catch (RemoteException re) { - Log.w(TAG, "Failed talking with device policy service", re); - } + try { + mService.uninstallCaCerts(admin, new TrustedCertificateStore().userAliases() + .toArray(new String[0])); + } catch (RemoteException re) { + Log.w(TAG, "Failed talking with device policy service", re); } } } diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 8c7b20a..a700806 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -128,7 +128,7 @@ interface IDevicePolicyManager { boolean hasUserSetupCompleted(); boolean installCaCert(in ComponentName admin, in byte[] certBuffer); - void uninstallCaCert(in ComponentName admin, in String alias); + void uninstallCaCerts(in ComponentName admin, in String[] aliases); void enforceCanManageCaCerts(in ComponentName admin); boolean installKeyPair(in ComponentName who, in byte[] privKeyBuffer, in byte[] certBuffer, String alias); diff --git a/core/java/android/content/ContentProviderOperation.java b/core/java/android/content/ContentProviderOperation.java index 49ac062..fd1e24a 100644 --- a/core/java/android/content/ContentProviderOperation.java +++ b/core/java/android/content/ContentProviderOperation.java @@ -28,6 +28,11 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +/** + * Represents a single operation to be performed as part of a batch of operations. + * + * @see ContentProvider#applyBatch(ArrayList) + */ public class ContentProviderOperation implements Parcelable { /** @hide exposed for unit tests */ public final static int TYPE_INSERT = 1; @@ -195,10 +200,19 @@ public class ContentProviderOperation implements Parcelable { return new Builder(TYPE_ASSERT, uri); } + /** + * Gets the Uri for the target of the operation. + */ public Uri getUri() { return mUri; } + /** + * Returns true if the operation allows yielding the database to other transactions + * if the database is contended. + * + * @see android.database.sqlite.SQLiteDatabase#yieldIfContendedSafely() + */ public boolean isYieldAllowed() { return mYieldAllowed; } @@ -208,26 +222,58 @@ public class ContentProviderOperation implements Parcelable { return mType; } + /** + * Returns true if the operation represents an insertion. + * + * @see #newInsert + */ public boolean isInsert() { return mType == TYPE_INSERT; } + /** + * Returns true if the operation represents a deletion. + * + * @see #newDelete + */ public boolean isDelete() { return mType == TYPE_DELETE; } + /** + * Returns true if the operation represents an update. + * + * @see #newUpdate + */ public boolean isUpdate() { return mType == TYPE_UPDATE; } + /** + * Returns true if the operation represents an assert query. + * + * @see #newAssertQuery + */ public boolean isAssertQuery() { return mType == TYPE_ASSERT; } + /** + * Returns true if the operation represents an insertion, deletion, or update. + * + * @see #isInsert + * @see #isDelete + * @see #isUpdate + */ public boolean isWriteOperation() { return mType == TYPE_DELETE || mType == TYPE_INSERT || mType == TYPE_UPDATE; } + /** + * Returns true if the operation represents an assert query. + * + * @see #isAssertQuery + */ public boolean isReadOperation() { return mType == TYPE_ASSERT; } @@ -617,7 +663,7 @@ public class ContentProviderOperation implements Parcelable { } /** - * If set then if the number of rows affected by this operation do not match + * If set then if the number of rows affected by this operation does not match * this count {@link OperationApplicationException} will be throw. * This can only be used with builders of type update, delete, or assert. * @return this builder, to allow for chaining. @@ -631,6 +677,12 @@ public class ContentProviderOperation implements Parcelable { return this; } + /** + * If set to true then the operation allows yielding the database to other transactions + * if the database is contended. + * @return this builder, to allow for chaining. + * @see android.database.sqlite.SQLiteDatabase#yieldIfContendedSafely() + */ public Builder withYieldAllowed(boolean yieldAllowed) { mYieldAllowed = yieldAllowed; return this; diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index a434c7b..970623a 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -1256,7 +1256,7 @@ public abstract class Context { * @param intent The description of the activity to start. * * @throws ActivityNotFoundException - * + *` * @see #startActivity(Intent, Bundle) * @see PackageManager#resolveActivity */ @@ -2443,8 +2443,6 @@ public abstract class Context { * * @param serviceClass The class of the desired service. * @return The service name or null if the class is not a supported system service. - * - * @hide */ public abstract String getSystemServiceName(Class<?> serviceClass); diff --git a/core/java/android/content/pm/IOnPermissionsChangeListener.aidl b/core/java/android/content/pm/IOnPermissionsChangeListener.aidl new file mode 100644 index 0000000..7791b50 --- /dev/null +++ b/core/java/android/content/pm/IOnPermissionsChangeListener.aidl @@ -0,0 +1,25 @@ +/* + * Copyright (C) 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 may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.content.pm; + +/** + * Listener for changes in the permissions for installed packages. + * {@hide} + */ +oneway interface IOnPermissionsChangeListener { + void onPermissionsChanged(int uid); +} diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 00b8c71..0c07bc3 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -31,6 +31,7 @@ import android.content.pm.IPackageDeleteObserver2; import android.content.pm.IPackageDataObserver; import android.content.pm.IPackageMoveObserver; import android.content.pm.IPackageStatsObserver; +import android.content.pm.IOnPermissionsChangeListener; import android.content.pm.IntentFilterVerificationInfo; import android.content.pm.InstrumentationInfo; import android.content.pm.KeySet; @@ -490,4 +491,7 @@ interface IPackageManager { KeySet getSigningKeySet(String packageName); boolean isPackageSignedByKeySet(String packageName, in KeySet ks); boolean isPackageSignedByKeySetExactly(String packageName, in KeySet ks); + + void addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener); + void removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener); } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 68092c8..bd50ca0 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -16,11 +16,13 @@ package android.content.pm; +import android.Manifest; import android.annotation.CheckResult; import android.annotation.DrawableRes; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.StringRes; @@ -78,6 +80,21 @@ public abstract class PackageManager { } /** + * Listener for changes in permissions granted to a UID. + * + * @hide + */ + @SystemApi + public interface OnPermissionsChangedListener { + + /** + * Called when the permissions for a UID change. + * @param uid The UID with a change. + */ + public void onPermissionsChanged(int uid); + } + + /** * {@link PackageInfo} flag: return information about * activities in the package in {@link PackageInfo#activities}. */ @@ -2636,7 +2653,7 @@ public abstract class PackageManager { /** * Retrieve the official name associated with a user id. This name is - * guaranteed to never change, though it is possibly for the underlying + * guaranteed to never change, though it is possible for the underlying * user id to be changed. That is, if you are storing information about * user ids in persistent storage, you should use the string returned * by this function instead of the raw user-id. @@ -4295,6 +4312,27 @@ public abstract class PackageManager { public abstract boolean isSafeMode(); /** + * Adds a listener for permission changes for installed packages. + * + * @param listener The listener to add. + * + * @hide + */ + @SystemApi + @RequiresPermission(Manifest.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS) + public abstract void addOnPermissionsChangeListener(OnPermissionsChangedListener listener); + + /** + * Remvoes a listener for permission changes for installed packages. + * + * @param listener The listener to remove. + * + * @hide + */ + @SystemApi + public abstract void removeOnPermissionsChangeListener(OnPermissionsChangedListener listener); + + /** * Return the {@link KeySet} associated with the String alias for this * application. * diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java index fda889f..d6b1142 100644 --- a/core/java/android/hardware/SensorManager.java +++ b/core/java/android/hardware/SensorManager.java @@ -1577,7 +1577,7 @@ public abstract class SensorManager { * Significant Motion, Step Counter etc. * * The tests which call this API need to have {@code - * android.permission.HARDWARE_TEST} permission which isn't + * android.permission.LOCATION_HADWARE} permission which isn't * available for third party applications. * * @param enable True to set the HAL in DATA_INJECTION mode. @@ -1607,7 +1607,7 @@ public abstract class SensorManager { * the HAL is already in data injection mode. * * The tests which call this API need to have {@code - * android.permission.HARDWARE_TEST} permission which isn't + * android.permission.LOCATION_HARDWARE} permission which isn't * available for third party applications. * * @param sensor The sensor to inject. diff --git a/core/java/android/hardware/SystemSensorManager.java b/core/java/android/hardware/SystemSensorManager.java index 22a9e9c..d7960af 100644 --- a/core/java/android/hardware/SystemSensorManager.java +++ b/core/java/android/hardware/SystemSensorManager.java @@ -80,7 +80,7 @@ public class SystemSensorManager extends SensorManager { nativeClassInit(); } mHasDataInjectionPermissions = context.checkSelfPermission( - Manifest.permission.HARDWARE_TEST) == PackageManager.PERMISSION_GRANTED; + Manifest.permission.LOCATION_HARDWARE) == PackageManager.PERMISSION_GRANTED; } // initialize the sensor list @@ -233,7 +233,7 @@ public class SystemSensorManager extends SensorManager { protected boolean enableDataInjectionImpl(boolean enable) { if (!mHasDataInjectionPermissions) { throw new SecurityException("Permission denial. Calling enableDataInjection without " - + Manifest.permission.HARDWARE_TEST); + + Manifest.permission.LOCATION_HARDWARE); } synchronized (mLock) { int ret = nativeEnableDataInjection(mNativeInstance, enable); @@ -256,7 +256,7 @@ public class SystemSensorManager extends SensorManager { long timestamp) { if (!mHasDataInjectionPermissions) { throw new SecurityException("Permission denial. Calling injectSensorData without " - + Manifest.permission.HARDWARE_TEST); + + Manifest.permission.LOCATION_HARDWARE); } synchronized (mLock) { if (!mDataInjectionMode) { diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index c073ba5..ed167f0 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -1924,6 +1924,28 @@ public class CameraDeviceImpl extends CameraDevice { return mCharacteristics; } + /** + * A high speed output surface can only be preview or hardware encoder surface. + * + * @param surface The high speed output surface to be checked. + */ + private void checkHighSpeedSurfaceFormat(Surface surface) { + // TODO: remove this override since the default format should be + // ImageFormat.PRIVATE. b/9487482 + final int HAL_FORMAT_RGB_START = 1; // HAL_PIXEL_FORMAT_RGBA_8888 from graphics.h + final int HAL_FORMAT_RGB_END = 5; // HAL_PIXEL_FORMAT_BGRA_8888 from graphics.h + int surfaceFormat = SurfaceUtils.getSurfaceFormat(surface); + if (surfaceFormat >= HAL_FORMAT_RGB_START && + surfaceFormat <= HAL_FORMAT_RGB_END) { + surfaceFormat = ImageFormat.PRIVATE; + } + + if (surfaceFormat != ImageFormat.PRIVATE) { + throw new IllegalArgumentException("Surface format(" + surfaceFormat + ") is not" + + " for preview or hardware video encoding!"); + } + } + private void checkConstrainedHighSpeedSurfaces(Collection<Surface> surfaces, Range<Integer> fpsRange) { if (surfaces == null || surfaces.size() == 0 || surfaces.size() > 2) { @@ -1948,15 +1970,10 @@ public class CameraDeviceImpl extends CameraDevice { } for (Surface surface : surfaces) { + checkHighSpeedSurfaceFormat(surface); + // Surface size must be supported high speed sizes. Size surfaceSize = SurfaceUtils.getSurfaceSize(surface); - int surfaceFormat = SurfaceUtils.getSurfaceFormat(surface); - - if (surfaceFormat != ImageFormat.PRIVATE) { - throw new IllegalArgumentException("Surface format is not for preview or" - + " hardware video encoding" + surfaceFormat); - } - if (!highSpeedSizes.contains(surfaceSize)) { throw new IllegalArgumentException("Surface size " + surfaceSize.toString() + " is" + " not part of the high speed supported size list " + diff --git a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java index cc9d496..a3a998e 100644 --- a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java +++ b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java @@ -565,7 +565,7 @@ public class LegacyCameraDevice implements AutoCloseable { throw new IllegalArgumentException("Surface was abandoned", e); } - return previewConsumer && (surfaceFormat == ImageFormat.PRIVATE); + return previewConsumer; } public static boolean isVideoEncoderConsumer(Surface output) { @@ -583,7 +583,7 @@ public class LegacyCameraDevice implements AutoCloseable { throw new IllegalArgumentException("Surface was abandoned", e); } - return videoEncoderConsumer && (surfaceFormat == ImageFormat.PRIVATE); + return videoEncoderConsumer; } /** diff --git a/core/java/android/hardware/camera2/utils/SurfaceUtils.java b/core/java/android/hardware/camera2/utils/SurfaceUtils.java index 32e74e2..40005a5 100644 --- a/core/java/android/hardware/camera2/utils/SurfaceUtils.java +++ b/core/java/android/hardware/camera2/utils/SurfaceUtils.java @@ -16,6 +16,7 @@ package android.hardware.camera2.utils; +import android.graphics.ImageFormat; import android.hardware.camera2.legacy.LegacyCameraDevice; import android.hardware.camera2.legacy.LegacyExceptionUtils.BufferQueueAbandonedException; import android.util.Size; @@ -27,7 +28,7 @@ import android.view.Surface; public class SurfaceUtils { /** - * Check if a surface is for preview consumer. + * Check if a surface is for preview consumer based on consumer end point Gralloc usage flags. * * @param surface The surface to be checked. * @return true if the surface is for preview consumer, false otherwise. @@ -37,7 +38,8 @@ public class SurfaceUtils { } /** - * Check if the surface is for hardware video encoder consumer. + * Check if the surface is for hardware video encoder consumer based on consumer end point + * Gralloc usage flags. * * @param surface The surface to be checked. * @return true if the surface is for hardware video encoder consumer, false otherwise. diff --git a/core/java/android/hardware/usb/IUsbManager.aidl b/core/java/android/hardware/usb/IUsbManager.aidl index 881dc0f..31a6a96 100644 --- a/core/java/android/hardware/usb/IUsbManager.aidl +++ b/core/java/android/hardware/usb/IUsbManager.aidl @@ -85,6 +85,16 @@ interface IUsbManager /* Sets the current USB function. */ void setCurrentFunction(String function); + /* Sets whether USB data (for example, MTP exposed pictures) should be made + * available on the USB connection. Unlocking data should only be done with + * user involvement, since exposing pictures or other data could leak sensitive + * user information. + */ + void setUsbDataUnlocked(boolean unlock); + + /* Returns true iff sensitive user data is exposed on the USB connection. */ + boolean isUsbDataUnlocked(); + /* Allow USB debugging from the attached host. If alwaysAllow is true, add the * the public key to list of host keys that the user has approved. */ diff --git a/core/java/android/hardware/usb/UsbManager.java b/core/java/android/hardware/usb/UsbManager.java index 000d41f..c83f466 100644 --- a/core/java/android/hardware/usb/UsbManager.java +++ b/core/java/android/hardware/usb/UsbManager.java @@ -142,6 +142,16 @@ public class UsbManager { public static final String USB_CONFIGURED = "configured"; /** + * Boolean extra indicating whether confidential user data, such as photos, should be + * made available on the USB connection. This variable will only be set when the user + * has explicitly asked for this data to be unlocked. + * Used in extras for the {@link #ACTION_USB_STATE} broadcast. + * + * {@hide} + */ + public static final String USB_DATA_UNLOCKED = "unlocked"; + + /** * Name of the USB mass storage USB function. * Used in extras for the {@link #ACTION_USB_STATE} broadcast * @@ -464,4 +474,34 @@ public class UsbManager { Log.e(TAG, "RemoteException in setCurrentFunction", e); } } + + /** + * Sets whether USB data (for example, MTP exposed pictures) should be made available + * on the USB connection. Unlocking usb data should only be done with user involvement, + * since exposing pictures or other data could leak sensitive user information. + * + * {@hide} + */ + public void setUsbDataUnlocked(boolean unlocked) { + try { + mService.setUsbDataUnlocked(unlocked); + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in setUsbDataUnlocked", e); + } + } + + /** + * Returns {@code true} iff access to sensitive USB data is currently allowed. + * + * {@hide} + */ + public boolean isUsbDataUnlocked() { + try { + return mService.isUsbDataUnlocked(); + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in isUsbDataUnlocked", e); + } + return false; + } + } diff --git a/core/java/android/net/NetworkFactory.java b/core/java/android/net/NetworkFactory.java index e47220b..5f46c73 100644 --- a/core/java/android/net/NetworkFactory.java +++ b/core/java/android/net/NetworkFactory.java @@ -24,8 +24,13 @@ import android.os.Messenger; import android.util.Log; import android.util.SparseArray; +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Protocol; +import java.io.FileDescriptor; +import java.io.PrintWriter; + /** * A NetworkFactory is an entity that creates NetworkAgent objects. * The bearers register with ConnectivityService using {@link #register} and @@ -157,6 +162,11 @@ public class NetworkFactory extends Handler { this.score = score; this.requested = false; } + + @Override + public String toString() { + return "{" + request + ", score=" + score + ", requested=" + requested + "}"; + } } private void handleAddRequest(NetworkRequest request, int score) { @@ -176,9 +186,9 @@ public class NetworkFactory extends Handler { private void handleRemoveRequest(NetworkRequest request) { NetworkRequestInfo n = mNetworkRequests.get(request.requestId); - if (n != null && n.requested) { + if (n != null) { mNetworkRequests.remove(request.requestId); - releaseNetworkFor(n.request); + if (n.requested) releaseNetworkFor(n.request); } } @@ -273,15 +283,31 @@ public class NetworkFactory extends Handler { sendMessage(obtainMessage(CMD_SET_FILTER, new NetworkCapabilities(netCap))); } + @VisibleForTesting + protected int getRequestCount() { + return mNetworkRequests.size(); + } + protected void log(String s) { Log.d(LOG_TAG, s); } + public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { + final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " "); + pw.println(toString()); + pw.increaseIndent(); + for (int i = 0; i < mNetworkRequests.size(); i++) { + pw.println(mNetworkRequests.valueAt(i)); + } + pw.decreaseIndent(); + } + @Override public String toString() { StringBuilder sb = new StringBuilder("{").append(LOG_TAG).append(" - ScoreFilter="). append(mScore).append(", Filter=").append(mCapabilityFilter).append(", requests="). - append(mNetworkRequests.size()).append("}"); + append(mNetworkRequests.size()).append(", refCount=").append(mRefCount). + append("}"); return sb.toString(); } } diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index c9609e5..a6efc58 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -3489,57 +3489,90 @@ public abstract class BatteryStats implements Parcelable { pw.println(); for (int i=0; i<sippers.size(); i++) { final BatterySipper bs = sippers.get(i); + pw.print(prefix); switch (bs.drainType) { case IDLE: - pw.print(prefix); pw.print(" Idle: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Idle: "); break; case CELL: - pw.print(prefix); pw.print(" Cell standby: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Cell standby: "); break; case PHONE: - pw.print(prefix); pw.print(" Phone calls: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Phone calls: "); break; case WIFI: - pw.print(prefix); pw.print(" Wifi: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Wifi: "); break; case BLUETOOTH: - pw.print(prefix); pw.print(" Bluetooth: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Bluetooth: "); break; case SCREEN: - pw.print(prefix); pw.print(" Screen: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Screen: "); break; case FLASHLIGHT: - pw.print(prefix); pw.print(" Flashlight: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Flashlight: "); break; case APP: - pw.print(prefix); pw.print(" Uid "); + pw.print(" Uid "); UserHandle.formatUid(pw, bs.uidObj.getUid()); - pw.print(": "); printmAh(pw, bs.totalPowerMah); pw.println(); + pw.print(": "); break; case USER: - pw.print(prefix); pw.print(" User "); pw.print(bs.userId); - pw.print(": "); printmAh(pw, bs.totalPowerMah); pw.println(); + pw.print(" User "); pw.print(bs.userId); + pw.print(": "); break; case UNACCOUNTED: - pw.print(prefix); pw.print(" Unaccounted: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Unaccounted: "); break; case OVERCOUNTED: - pw.print(prefix); pw.print(" Over-counted: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Over-counted: "); break; case CAMERA: - pw.print(prefix); pw.print(" Camera: "); printmAh(pw, bs.totalPowerMah); - pw.println(); + pw.print(" Camera: "); + break; + default: + pw.print(" ???: "); break; } + printmAh(pw, bs.totalPowerMah); + + if (bs.drainType == BatterySipper.DrainType.APP) { + pw.print(" ("); + if (bs.cpuPowerMah != 0) { + pw.print(" cpu="); + printmAh(pw, bs.cpuPowerMah); + } + if (bs.wakeLockPowerMah != 0) { + pw.print(" wake="); + printmAh(pw, bs.wakeLockPowerMah); + } + if (bs.mobileRadioPowerMah != 0) { + pw.print(" radio="); + printmAh(pw, bs.mobileRadioPowerMah); + } + if (bs.wifiPowerMah != 0) { + pw.print(" wifi="); + printmAh(pw, bs.wifiPowerMah); + } + if (bs.gpsPowerMah != 0) { + pw.print(" gps="); + printmAh(pw, bs.gpsPowerMah); + } + if (bs.sensorPowerMah != 0) { + pw.print(" sensor="); + printmAh(pw, bs.sensorPowerMah); + } + if (bs.cameraPowerMah != 0) { + pw.print(" camera="); + printmAh(pw, bs.cameraPowerMah); + } + if (bs.flashlightPowerMah != 0) { + pw.print(" flash="); + printmAh(pw, bs.flashlightPowerMah); + } + pw.print(" )"); + } + pw.println(); } pw.println(); } diff --git a/core/java/android/os/RemoteCallbackList.java b/core/java/android/os/RemoteCallbackList.java index d2a9cdc..5849350 100644 --- a/core/java/android/os/RemoteCallbackList.java +++ b/core/java/android/os/RemoteCallbackList.java @@ -77,7 +77,6 @@ public class RemoteCallbackList<E extends IInterface> { public boolean register(E callback) { return register(callback, null); } - /** * Add a new callback to the list. This callback will remain in the list * until a corresponding call to {@link #unregister} or its hosting process diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java index 2622ee0..372725f 100644 --- a/core/java/android/os/storage/VolumeInfo.java +++ b/core/java/android/os/storage/VolumeInfo.java @@ -32,7 +32,9 @@ import android.text.TextUtils; import android.util.ArrayMap; import android.util.DebugUtils; import android.util.SparseArray; +import android.util.SparseIntArray; +import com.android.internal.R; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; @@ -80,6 +82,7 @@ public class VolumeInfo implements Parcelable { private static SparseArray<String> sStateToEnvironment = new SparseArray<>(); private static ArrayMap<String, String> sEnvironmentToBroadcast = new ArrayMap<>(); + private static SparseIntArray sStateToDescrip = new SparseIntArray(); private static final Comparator<VolumeInfo> sDescriptionComparator = new Comparator<VolumeInfo>() { @@ -116,6 +119,16 @@ public class VolumeInfo implements Parcelable { sEnvironmentToBroadcast.put(Environment.MEDIA_UNMOUNTABLE, Intent.ACTION_MEDIA_UNMOUNTABLE); sEnvironmentToBroadcast.put(Environment.MEDIA_REMOVED, Intent.ACTION_MEDIA_REMOVED); sEnvironmentToBroadcast.put(Environment.MEDIA_BAD_REMOVAL, Intent.ACTION_MEDIA_BAD_REMOVAL); + + sStateToDescrip.put(VolumeInfo.STATE_UNMOUNTED, R.string.ext_media_status_unmounted); + sStateToDescrip.put(VolumeInfo.STATE_CHECKING, R.string.ext_media_status_checking); + sStateToDescrip.put(VolumeInfo.STATE_MOUNTED, R.string.ext_media_status_mounted); + sStateToDescrip.put(VolumeInfo.STATE_MOUNTED_READ_ONLY, R.string.ext_media_status_mounted_ro); + sStateToDescrip.put(VolumeInfo.STATE_FORMATTING, R.string.ext_media_status_formatting); + sStateToDescrip.put(VolumeInfo.STATE_EJECTING, R.string.ext_media_status_ejecting); + sStateToDescrip.put(VolumeInfo.STATE_UNMOUNTABLE, R.string.ext_media_status_unmountable); + sStateToDescrip.put(VolumeInfo.STATE_REMOVED, R.string.ext_media_status_removed); + sStateToDescrip.put(VolumeInfo.STATE_BAD_REMOVAL, R.string.ext_media_status_bad_removal); } /** vold state */ @@ -201,6 +214,10 @@ public class VolumeInfo implements Parcelable { return state; } + public int getStateDescription() { + return sStateToDescrip.get(state, 0); + } + public @Nullable String getFsUuid() { return fsUuid; } diff --git a/core/java/android/preference/SeekBarDialogPreference.java b/core/java/android/preference/SeekBarDialogPreference.java index 9a08827..eeb69a3 100644 --- a/core/java/android/preference/SeekBarDialogPreference.java +++ b/core/java/android/preference/SeekBarDialogPreference.java @@ -18,29 +18,28 @@ package android.preference; import android.content.Context; import android.graphics.drawable.Drawable; -import android.preference.DialogPreference; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; import android.widget.SeekBar; +import com.android.internal.R; + /** * @hide */ public class SeekBarDialogPreference extends DialogPreference { - private static final String TAG = "SeekBarDialogPreference"; - - private Drawable mMyIcon; + private final Drawable mMyIcon; public SeekBarDialogPreference( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); - setDialogLayoutResource(com.android.internal.R.layout.seekbar_dialog); createActionButtons(); // Steal the XML dialogIcon attribute's value mMyIcon = getDialogIcon(); + setDialogIcon(null); } @@ -49,7 +48,7 @@ public class SeekBarDialogPreference extends DialogPreference { } public SeekBarDialogPreference(Context context, AttributeSet attrs) { - this(context, attrs, com.android.internal.R.attr.dialogPreferenceStyle); + this(context, attrs, R.attr.seekBarDialogPreferenceStyle); } public SeekBarDialogPreference(Context context) { @@ -58,15 +57,15 @@ public class SeekBarDialogPreference extends DialogPreference { // Allow subclasses to override the action buttons public void createActionButtons() { - setPositiveButtonText(android.R.string.ok); - setNegativeButtonText(android.R.string.cancel); + setPositiveButtonText(R.string.ok); + setNegativeButtonText(R.string.cancel); } @Override protected void onBindDialogView(View view) { super.onBindDialogView(view); - final ImageView iconView = (ImageView) view.findViewById(android.R.id.icon); + final ImageView iconView = (ImageView) view.findViewById(R.id.icon); if (mMyIcon != null) { iconView.setImageDrawable(mMyIcon); } else { @@ -75,6 +74,6 @@ public class SeekBarDialogPreference extends DialogPreference { } protected static SeekBar getSeekBar(View dialogView) { - return (SeekBar) dialogView.findViewById(com.android.internal.R.id.seekbar); + return (SeekBar) dialogView.findViewById(R.id.seekbar); } } diff --git a/core/java/android/preference/SeekBarVolumizer.java b/core/java/android/preference/SeekBarVolumizer.java index 4bd085f..979c828 100644 --- a/core/java/android/preference/SeekBarVolumizer.java +++ b/core/java/android/preference/SeekBarVolumizer.java @@ -16,6 +16,7 @@ package android.preference; +import android.app.NotificationManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -31,6 +32,7 @@ import android.os.HandlerThread; import android.os.Message; import android.preference.VolumePreference.VolumeStore; import android.provider.Settings; +import android.provider.Settings.Global; import android.provider.Settings.System; import android.util.Log; import android.widget.SeekBar; @@ -46,7 +48,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba public interface Callback { void onSampleStarting(SeekBarVolumizer sbv); void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch); - void onMuted(boolean muted); + void onMuted(boolean muted, boolean zenMuted); } private final Context mContext; @@ -54,6 +56,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba private final Callback mCallback; private final Uri mDefaultUri; private final AudioManager mAudioManager; + private final NotificationManager mNotificationManager; private final int mStreamType; private final int mMaxStreamVolume; private boolean mAffectedByRingerMode; @@ -63,12 +66,14 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba private Handler mHandler; private Observer mVolumeObserver; private int mOriginalStreamVolume; + private int mLastAudibleStreamVolume; private Ringtone mRingtone; private int mLastProgress = -1; private boolean mMuted; private SeekBar mSeekBar; private int mVolumeBeforeMute = -1; private int mRingerMode; + private int mZenMode; private static final int MSG_SET_STREAM_VOLUME = 0; private static final int MSG_START_SAMPLE = 1; @@ -78,19 +83,22 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba public SeekBarVolumizer(Context context, int streamType, Uri defaultUri, Callback callback) { mContext = context; - mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + mAudioManager = context.getSystemService(AudioManager.class); + mNotificationManager = context.getSystemService(NotificationManager.class); mStreamType = streamType; mAffectedByRingerMode = mAudioManager.isStreamAffectedByRingerMode(mStreamType); mNotificationOrRing = isNotificationOrRing(mStreamType); if (mNotificationOrRing) { mRingerMode = mAudioManager.getRingerModeInternal(); } + mZenMode = mNotificationManager.getZenMode(); mMaxStreamVolume = mAudioManager.getStreamMaxVolume(mStreamType); mCallback = callback; mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType); + mLastAudibleStreamVolume = mAudioManager.getLastAudibleStreamVolume(mStreamType); mMuted = mAudioManager.isStreamMute(mStreamType); if (mCallback != null) { - mCallback.onMuted(mMuted); + mCallback.onMuted(mMuted, isZenMuted()); } if (defaultUri == null) { if (mStreamType == AudioManager.STREAM_RING) { @@ -119,8 +127,17 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba mSeekBar.setOnSeekBarChangeListener(this); } + private boolean isZenMuted() { + return mNotificationOrRing && mZenMode == Global.ZEN_MODE_ALARMS + || mZenMode == Global.ZEN_MODE_NO_INTERRUPTIONS; + } + protected void updateSeekBar() { - if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { + final boolean zenMuted = isZenMuted(); + mSeekBar.setEnabled(!zenMuted); + if (zenMuted) { + mSeekBar.setProgress(mLastAudibleStreamVolume); + } else if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { mSeekBar.setProgress(0); } else if (mMuted) { mSeekBar.setProgress(0); @@ -316,11 +333,12 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba if (msg.what == UPDATE_SLIDER) { if (mSeekBar != null) { mLastProgress = msg.arg1; - final boolean muted = msg.arg2 != 0; + mLastAudibleStreamVolume = Math.abs(msg.arg2); + final boolean muted = msg.arg2 < 0; if (muted != mMuted) { mMuted = muted; if (mCallback != null) { - mCallback.onMuted(mMuted); + mCallback.onMuted(mMuted, isZenMuted()); } } updateSeekBar(); @@ -328,16 +346,18 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } } - public void postUpdateSlider(int volume, boolean mute) { - obtainMessage(UPDATE_SLIDER, volume, mute ? 1 : 0).sendToTarget(); + public void postUpdateSlider(int volume, int lastAudibleVolume, boolean mute) { + final int arg2 = lastAudibleVolume * (mute ? -1 : 1); + obtainMessage(UPDATE_SLIDER, volume, arg2).sendToTarget(); } } private void updateSlider() { if (mSeekBar != null && mAudioManager != null) { final int volume = mAudioManager.getStreamVolume(mStreamType); + final int lastAudibleVolume = mAudioManager.getLastAudibleStreamVolume(mStreamType); final boolean mute = mAudioManager.isStreamMute(mStreamType); - mUiHandler.postUpdateSlider(volume, mute); + mUiHandler.postUpdateSlider(volume, lastAudibleVolume, mute); } } @@ -362,6 +382,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba if (listening) { final IntentFilter filter = new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION); filter.addAction(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION); + filter.addAction(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED); mContext.registerReceiver(this, filter); } else { mContext.unregisterReceiver(this); @@ -379,7 +400,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba if (mSeekBar != null && streamMatch && streamValue != -1) { final boolean muted = mAudioManager.isStreamMute(mStreamType) || streamValue == 0; - mUiHandler.postUpdateSlider(streamValue, muted); + mUiHandler.postUpdateSlider(streamValue, mLastAudibleStreamVolume, muted); } } else if (AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION.equals(action)) { if (mNotificationOrRing) { @@ -388,6 +409,9 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba if (mAffectedByRingerMode) { updateSlider(); } + } else if (NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED.equals(action)) { + mZenMode = mNotificationManager.getZenMode(); + updateSlider(); } } } diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java index a2da01b..8a66c24 100644 --- a/core/java/android/preference/VolumePreference.java +++ b/core/java/android/preference/VolumePreference.java @@ -26,14 +26,13 @@ import android.view.KeyEvent; import android.view.View; import android.widget.SeekBar; +import com.android.internal.R; + /** * @hide */ public class VolumePreference extends SeekBarDialogPreference implements PreferenceManager.OnActivityStopListener, View.OnKeyListener, SeekBarVolumizer.Callback { - - static final String TAG = "VolumePreference"; - private int mStreamType; /** May be null if the dialog isn't visible. */ @@ -44,7 +43,7 @@ public class VolumePreference extends SeekBarDialogPreference implements super(context, attrs, defStyleAttr, defStyleRes); final TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.VolumePreference, defStyleAttr, defStyleRes); + R.styleable.VolumePreference, defStyleAttr, defStyleRes); mStreamType = a.getInt(android.R.styleable.VolumePreference_streamType, 0); a.recycle(); } @@ -54,7 +53,11 @@ public class VolumePreference extends SeekBarDialogPreference implements } public VolumePreference(Context context, AttributeSet attrs) { - this(context, attrs, com.android.internal.R.attr.dialogPreferenceStyle); + this(context, attrs, R.attr.seekBarDialogPreferenceStyle); + } + + public VolumePreference(Context context) { + this(context, null); } public void setStreamType(int streamType) { @@ -65,7 +68,7 @@ public class VolumePreference extends SeekBarDialogPreference implements protected void onBindDialogView(View view) { super.onBindDialogView(view); - final SeekBar seekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar); + final SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar); mSeekBarVolumizer = new SeekBarVolumizer(getContext(), mStreamType, null, this); mSeekBarVolumizer.start(); mSeekBarVolumizer.setSeekBar(seekBar); @@ -128,14 +131,17 @@ public class VolumePreference extends SeekBarDialogPreference implements getPreferenceManager().unregisterOnActivityStopListener(this); if (mSeekBarVolumizer != null) { - Dialog dialog = getDialog(); + final Dialog dialog = getDialog(); if (dialog != null && dialog.isShowing()) { - View view = dialog.getWindow().getDecorView() - .findViewById(com.android.internal.R.id.seekbar); - if (view != null) view.setOnKeyListener(null); + final View view = dialog.getWindow().getDecorView().findViewById(R.id.seekbar); + if (view != null) { + view.setOnKeyListener(null); + } + // Stopped while dialog was showing, revert changes mSeekBarVolumizer.revertVolume(); } + mSeekBarVolumizer.stop(); mSeekBarVolumizer = null; } @@ -155,7 +161,7 @@ public class VolumePreference extends SeekBarDialogPreference implements } @Override - public void onMuted(boolean muted) { + public void onMuted(boolean muted, boolean zenMuted) { // noop } diff --git a/core/java/android/printservice/PrintService.java b/core/java/android/printservice/PrintService.java index 527c8ae..6295822 100644 --- a/core/java/android/printservice/PrintService.java +++ b/core/java/android/printservice/PrintService.java @@ -231,6 +231,19 @@ public abstract class PrintService extends Service { */ public static final String EXTRA_PRINTER_INFO = "android.intent.extra.print.EXTRA_PRINTER_INFO"; + /** + * If you declared an optional activity with advanced print options via the + * {@link android.R.attr#advancedPrintOptionsActivity advancedPrintOptionsActivity} + * attribute, this extra is used to pass in the meta-data for the currently printed + * document as a {@link android.print.PrintDocumentInfo} to your activity allowing + * you to inspect it. + * + * @see #EXTRA_PRINT_JOB_INFO + * @see #EXTRA_PRINTER_INFO + */ + public static final String EXTRA_PRINT_DOCUMENT_INFO = + "android.printservice.extra.PRINT_DOCUMENT_INFO"; + private Handler mHandler; private IPrintServiceClient mClient; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 640f434..167d8e5 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -577,6 +577,21 @@ public final class Settings { "android.settings.APPLICATION_DETAILS_SETTINGS"; /** + * Activity Action: Show screen for controlling which apps can ignore battery optimizations. + * <p> + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + * <p> + * Input: The Intent's data URI specifies the application package name + * to be shown, with the "package" scheme. That is "package:com.my.app". + * <p> + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS = + "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"; + + /** * @hide * Activity Action: Show the "app ops" settings screen. * <p> diff --git a/core/java/android/text/Spanned.java b/core/java/android/text/Spanned.java index b4622e0..a785d1b 100644 --- a/core/java/android/text/Spanned.java +++ b/core/java/android/text/Spanned.java @@ -187,12 +187,11 @@ extends CharSequence public int getSpanFlags(Object tag); /** - * Return the first offset greater than or equal to <code>start</code> - * where a markup object of class <code>type</code> begins or ends, - * or <code>limit</code> if there are no starts or ends greater than or - * equal to <code>start</code> but less than <code>limit</code>. Specify - * <code>null</code> or Object.class for the type if you want every - * transition regardless of type. + * Return the first offset greater than <code>start</code> where a markup + * object of class <code>type</code> begins or ends, or <code>limit</code> + * if there are no starts or ends greater than <code>start</code> but less + * than <code>limit</code>. Specify <code>null</code> or Object.class for + * the type if you want every transition regardless of type. */ public int nextSpanTransition(int start, int limit, Class type); } diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java index dc8cadf..1c67ba7 100644 --- a/core/java/android/view/MenuInflater.java +++ b/core/java/android/view/MenuInflater.java @@ -25,11 +25,8 @@ import android.annotation.MenuRes; import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; -import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; -import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; @@ -337,11 +334,6 @@ public class MenuInflater { private ActionProvider itemActionProvider; - private ColorStateList itemIconTintList; - private boolean itemIconTintListSet; - private PorterDuff.Mode itemIconTintMode; - private boolean itemIconTintModeSet; - private static final int defaultGroupId = NO_ID; private static final int defaultItemId = NO_ID; private static final int defaultItemCategory = 0; @@ -432,23 +424,6 @@ public class MenuInflater { itemActionProvider = null; } - if (a.hasValueOrEmpty(com.android.internal.R.styleable.MenuItem_iconTint)) { - itemIconTintList = a.getColorStateList( - com.android.internal.R.styleable.MenuItem_iconTint); - itemIconTintListSet = true; - } else { - itemIconTintList = null; - itemIconTintListSet = false; - } - if (a.hasValueOrEmpty(com.android.internal.R.styleable.MenuItem_iconTintMode)) { - itemIconTintMode = Drawable.parseTintMode( - a.getInt(com.android.internal.R.styleable.MenuItem_iconTintMode, -1), null); - itemIconTintModeSet = true; - } else { - itemIconTintMode = null; - itemIconTintModeSet = false; - } - a.recycle(); itemAdded = false; @@ -511,13 +486,6 @@ public class MenuInflater { if (itemActionProvider != null) { item.setActionProvider(itemActionProvider); } - - if (itemIconTintListSet) { - item.setIconTintList(itemIconTintList); - } - if (itemIconTintModeSet) { - item.setIconTintMode(itemIconTintMode); - } } public MenuItem addItem() { diff --git a/core/java/android/view/MenuItem.java b/core/java/android/view/MenuItem.java index 2948007..9e8b97e 100644 --- a/core/java/android/view/MenuItem.java +++ b/core/java/android/view/MenuItem.java @@ -21,8 +21,6 @@ import android.annotation.LayoutRes; import android.annotation.StringRes; import android.app.Activity; import android.content.Intent; -import android.content.res.ColorStateList; -import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.view.ContextMenu.ContextMenuInfo; import android.view.View.OnCreateContextMenuListener; @@ -601,26 +599,4 @@ public interface MenuItem { * @return This menu item instance for call chaining */ public MenuItem setOnActionExpandListener(OnActionExpandListener listener); - - /** - * Applies a tint to the icon drawable. Does not modify the current tint - * mode, which is {@link PorterDuff.Mode#SRC_IN} by default. - * <p> - * Subsequent calls to {@link android.view.MenuItem#setIcon(android.graphics.drawable.Drawable)} - * will automatically mutate the drawable and apply the specified tint and tint mode. - * - * @param tint the tint to apply, may be {@code null} to clear tint - * @return This menu item instance for call chaining - */ - public MenuItem setIconTintList(ColorStateList tint); - - /** - * Specifies the blending mode used to apply the tint specified by {@link - * #setIconTintList(ColorStateList)} to the icon drawable. The default mode is {@link - * PorterDuff.Mode#SRC_IN}. - * - * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint - * @return This menu item instance for call chaining - */ - public MenuItem setIconTintMode(PorterDuff.Mode tintMode); } diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index f18b7ac..bd45007 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -80,18 +80,12 @@ public class ViewPropertyAnimator { /** * The interpolator of the underlying Animator object. By default, we don't set the interpolator - * on the Animator and just use its default interpolator. If the interpolator is ever set on - * this Animator, then we use the interpolator that it was set to. + * on the Animator and just use its default interpolator. If the interpolator is set to a + * non-null value on this Animator, then we use the interpolator that it was set to. */ private TimeInterpolator mInterpolator; /** - * A flag indicating whether the interpolator has been set on this object. If not, we don't set - * the interpolator on the underlying Animator, but instead just use its default interpolator. - */ - private boolean mInterpolatorSet = false; - - /** * Listener for the lifecycle events of the underlying ValueAnimator object. */ private Animator.AnimatorListener mListener = null; @@ -338,7 +332,6 @@ public class ViewPropertyAnimator { * @return This object, allowing calls to methods in this class to be chained. */ public ViewPropertyAnimator setInterpolator(TimeInterpolator interpolator) { - mInterpolatorSet = true; mInterpolator = interpolator; return this; } @@ -349,7 +342,7 @@ public class ViewPropertyAnimator { * @return The timing interpolator for this animation. */ public TimeInterpolator getInterpolator() { - if (mInterpolatorSet) { + if (mInterpolator != null) { return mInterpolator; } else { // Just return the default from ValueAnimator, since that's what we'd get if @@ -897,7 +890,7 @@ public class ViewPropertyAnimator { if (mDurationSet) { animator.setDuration(mDuration); } - if (mInterpolatorSet) { + if (mInterpolator != null) { animator.setInterpolator(mInterpolator); } animator.start(); diff --git a/core/java/android/widget/ActionMenuPresenter.java b/core/java/android/widget/ActionMenuPresenter.java index f08141c..a5696ee 100644 --- a/core/java/android/widget/ActionMenuPresenter.java +++ b/core/java/android/widget/ActionMenuPresenter.java @@ -21,10 +21,8 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; @@ -64,6 +62,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter private static final boolean ACTIONBAR_ANIMATIONS_ENABLED = false; private OverflowMenuButton mOverflowButton; + private Drawable mPendingOverflowIcon; + private boolean mPendingOverflowIconSet; private boolean mReserveOverflow; private boolean mReserveOverflowSet; private int mWidthLimit; @@ -85,8 +85,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter private OpenOverflowRunnable mPostedOpenRunnable; private ActionMenuPopupCallback mPopupCallback; - private TintInfo mOverflowTintInfo; - final PopupPresenterCallback mPopupPresenterCallback = new PopupPresenterCallback(); int mOpenSubMenuId; @@ -154,9 +152,13 @@ public class ActionMenuPresenter extends BaseMenuPresenter if (mReserveOverflow) { if (mOverflowButton == null) { mOverflowButton = new OverflowMenuButton(mSystemContext); + if (mPendingOverflowIconSet) { + mOverflowButton.setImageDrawable(mPendingOverflowIcon); + mPendingOverflowIcon = null; + mPendingOverflowIconSet = false; + } final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); mOverflowButton.measure(spec, spec); - applyOverflowTint(); } width -= mOverflowButton.getMeasuredWidth(); } else { @@ -198,6 +200,24 @@ public class ActionMenuPresenter extends BaseMenuPresenter mExpandedActionViewsExclusive = isExclusive; } + public void setOverflowIcon(Drawable icon) { + if (mOverflowButton != null) { + mOverflowButton.setImageDrawable(icon); + } else { + mPendingOverflowIconSet = true; + mPendingOverflowIcon = icon; + } + } + + public Drawable getOverflowIcon() { + if (mOverflowButton != null) { + return mOverflowButton.getDrawable(); + } else if (mPendingOverflowIconSet) { + return mPendingOverflowIcon; + } + return null; + } + @Override public MenuView getMenuView(ViewGroup root) { MenuView oldMenuView = mMenuView; @@ -449,7 +469,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter if (hasOverflow) { if (mOverflowButton == null) { mOverflowButton = new OverflowMenuButton(mSystemContext); - applyOverflowTint(); } ViewGroup parent = (ViewGroup) mOverflowButton.getParent(); if (parent != mMenuView) { @@ -764,40 +783,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter } } - public void setOverflowTintList(ColorStateList tint) { - if (mOverflowTintInfo == null) { - mOverflowTintInfo = new TintInfo(); - } - mOverflowTintInfo.mTintList = tint; - mOverflowTintInfo.mHasTintList = true; - - applyOverflowTint(); - } - - public void setOverflowTintMode(PorterDuff.Mode tintMode) { - if (mOverflowTintInfo == null) { - mOverflowTintInfo = new TintInfo(); - } - mOverflowTintInfo.mTintMode = tintMode; - mOverflowTintInfo.mHasTintMode = true; - - applyOverflowTint(); - } - - private void applyOverflowTint() { - final TintInfo tintInfo = mOverflowTintInfo; - if (tintInfo != null && (tintInfo.mHasTintList || tintInfo.mHasTintMode)) { - if (mOverflowButton != null) { - if (tintInfo.mHasTintList) { - mOverflowButton.setImageTintList(tintInfo.mTintList); - } - if (tintInfo.mHasTintMode) { - mOverflowButton.setImageTintMode(tintInfo.mTintMode); - } - } - } - } - private static class SavedState implements Parcelable { public int openSubMenuId; @@ -1023,13 +1008,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter } } - private static class TintInfo { - ColorStateList mTintList; - PorterDuff.Mode mTintMode; - boolean mHasTintMode; - boolean mHasTintList; - } - /** * This class holds layout information for a menu item. This is used to determine * pre- and post-layout information about menu items, which will then be used to @@ -1077,5 +1055,4 @@ public class ActionMenuPresenter extends BaseMenuPresenter this.animType = animType; } } - } diff --git a/core/java/android/widget/ActionMenuView.java b/core/java/android/widget/ActionMenuView.java index 278a8fb..1f02c3b 100644 --- a/core/java/android/widget/ActionMenuView.java +++ b/core/java/android/widget/ActionMenuView.java @@ -16,11 +16,11 @@ package android.widget; import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.StyleRes; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.Configuration; -import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.ContextThemeWrapper; import android.view.Gravity; @@ -541,39 +541,35 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo dismissPopupMenus(); } - /** @hide */ - public boolean isOverflowReserved() { - return mReserveOverflow; - } - - /** @hide */ - public void setOverflowReserved(boolean reserveOverflow) { - mReserveOverflow = reserveOverflow; - } - /** - * Applies a tint to the overflow drawable. Does not modify the current tint - * mode, which is {@link PorterDuff.Mode#SRC_IN} by default. + * Set the icon to use for the overflow button. * - * @param tint the tint to apply, may be {@code null} to clear tint + * @param icon Drawable to set, may be null to clear the icon */ - public void setOverflowTintList(ColorStateList tint) { - if (mPresenter != null) { - mPresenter.setOverflowTintList(tint); - } + public void setOverflowIcon(@Nullable Drawable icon) { + getMenu(); + mPresenter.setOverflowIcon(icon); } /** - * Specifies the blending mode used to apply the tint specified by {@link - * #setOverflowTintList(ColorStateList)} to the overflow drawable. - * The default mode is {@link PorterDuff.Mode#SRC_IN}. + * Return the current drawable used as the overflow icon. * - * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint + * @return The overflow icon drawable */ - public void setOverflowTintMode(PorterDuff.Mode tintMode) { - if (mPresenter != null) { - mPresenter.setOverflowTintMode(tintMode); - } + @Nullable + public Drawable getOverflowIcon() { + getMenu(); + return mPresenter.getOverflowIcon(); + } + + /** @hide */ + public boolean isOverflowReserved() { + return mReserveOverflow; + } + + /** @hide */ + public void setOverflowReserved(boolean reserveOverflow) { + mReserveOverflow = reserveOverflow; } @Override diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java index 94b9416..afc683a 100644 --- a/core/java/android/widget/ListPopupWindow.java +++ b/core/java/android/widget/ListPopupWindow.java @@ -618,12 +618,11 @@ public class ListPopupWindow { heightSpec = mDropDownHeight; } - mPopup.setWidth(widthSpec); - mPopup.setHeight(heightSpec); mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible); mPopup.update(getAnchorView(), mDropDownHorizontalOffset, - mDropDownVerticalOffset, -1, -1); + mDropDownVerticalOffset, (widthSpec < 0)? -1 : widthSpec, + (heightSpec < 0)? -1 : heightSpec); } else { final int widthSpec; if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) { diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java index 62d948d..8ace0f3 100644 --- a/core/java/android/widget/Toolbar.java +++ b/core/java/android/widget/Toolbar.java @@ -25,9 +25,8 @@ import android.annotation.StringRes; import android.annotation.StyleRes; import android.app.ActionBar; import android.content.Context; -import android.content.res.ColorStateList; import android.content.res.TypedArray; -import android.graphics.PorterDuff; +import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; @@ -110,9 +109,6 @@ public class Toolbar extends ViewGroup { private ImageButton mNavButtonView; private ImageView mLogoView; - private TintInfo mOverflowTintInfo; - private TintInfo mNavTintInfo; - private Drawable mCollapseIcon; private CharSequence mCollapseDescription; private ImageButton mCollapseButtonView; @@ -275,21 +271,6 @@ public class Toolbar extends ViewGroup { if (!TextUtils.isEmpty(navDesc)) { setNavigationContentDescription(navDesc); } - - if (a.hasValue(R.styleable.Toolbar_overflowTint)) { - setOverflowTintList(a.getColorStateList(R.styleable.Toolbar_overflowTint)); - } - if (a.hasValue(R.styleable.Toolbar_overflowTintMode)) { - setOverflowTintMode(Drawable.parseTintMode( - a.getInt(R.styleable.Toolbar_overflowTintMode, -1), null)); - } - if (a.hasValue(R.styleable.Toolbar_navigationTint)) { - setNavigationTintList(a.getColorStateList(R.styleable.Toolbar_navigationTint)); - } - if (a.hasValue(R.styleable.Toolbar_navigationTintMode)) { - setNavigationTintMode(Drawable.parseTintMode( - a.getInt(R.styleable.Toolbar_navigationTintMode, -1), null)); - } a.recycle(); } @@ -830,101 +811,37 @@ public class Toolbar extends ViewGroup { } /** - * Applies a tint to the icon drawable. Does not modify the current tint - * mode, which is {@link PorterDuff.Mode#SRC_IN} by default. - * <p> - * Subsequent calls to {@link #setNavigationIcon(Drawable)} will automatically mutate - * the drawable and apply the specified tint and tint mode. - * - * @param tint the tint to apply, may be {@code null} to clear tint - * - * @attr ref android.R.styleable#Toolbar_navigationTint - */ - public void setNavigationTintList(ColorStateList tint) { - if (mNavTintInfo == null) { - mNavTintInfo = new TintInfo(); - } - mNavTintInfo.mTintList = tint; - mNavTintInfo.mHasTintList = true; - - applyNavigationTint(); - } - - /** - * Specifies the blending mode used to apply the tint specified by {@link - * #setNavigationTintList(ColorStateList)} to the navigation drawable. - * The default mode is {@link PorterDuff.Mode#SRC_IN}. - * - * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint - * - * @attr ref android.R.styleable#Toolbar_navigationTintMode - */ - public void setNavigationTintMode(PorterDuff.Mode tintMode) { - if (mNavTintInfo == null) { - mNavTintInfo = new TintInfo(); - } - mNavTintInfo.mTintMode = tintMode; - mNavTintInfo.mHasTintMode = true; - - applyNavigationTint(); - } - - /** - * Applies a tint to the overflow drawable. Does not modify the current tint - * mode, which is {@link PorterDuff.Mode#SRC_IN} by default. + * Return the Menu shown in the toolbar. * - * @param tint the tint to apply, may be {@code null} to clear tint + * <p>Applications that wish to populate the toolbar's menu can do so from here. To use + * an XML menu resource, use {@link #inflateMenu(int)}.</p> * - * @attr ref android.R.styleable#Toolbar_overflowTint + * @return The toolbar's Menu */ - public void setOverflowTintList(ColorStateList tint) { - if (mMenuView != null) { - // If the menu view is available, directly set the tint - mMenuView.setOverflowTintList(tint); - } else { - // Otherwise we will record the value - if (mOverflowTintInfo == null) { - mOverflowTintInfo = new TintInfo(); - } - mOverflowTintInfo.mTintList = tint; - mOverflowTintInfo.mHasTintList = true; - } + public Menu getMenu() { + ensureMenu(); + return mMenuView.getMenu(); } /** - * Specifies the blending mode used to apply the tint specified by {@link - * #setOverflowTintList(ColorStateList)} to the overflow drawable. - * The default mode is {@link PorterDuff.Mode#SRC_IN}. - * - * @param tintMode the blending mode used to apply the tint, may be {@code null} to clear tint + * Set the icon to use for the overflow button. * - * @attr ref android.R.styleable#Toolbar_overflowTintMode + * @param icon Drawable to set, may be null to clear the icon */ - public void setOverflowTintMode(PorterDuff.Mode tintMode) { - if (mMenuView != null) { - // If the menu view is available, directly set the tint mode - mMenuView.setOverflowTintMode(tintMode); - } else { - // Otherwise we will record the value - if (mOverflowTintInfo == null) { - mOverflowTintInfo = new TintInfo(); - } - mOverflowTintInfo.mTintMode = tintMode; - mOverflowTintInfo.mHasTintMode = true; - } + public void setOverflowIcon(@Nullable Drawable icon) { + ensureMenu(); + mMenuView.setOverflowIcon(icon); } /** - * Return the Menu shown in the toolbar. - * - * <p>Applications that wish to populate the toolbar's menu can do so from here. To use - * an XML menu resource, use {@link #inflateMenu(int)}.</p> + * Return the current drawable used as the overflow icon. * - * @return The toolbar's Menu + * @return The overflow icon drawable */ - public Menu getMenu() { + @Nullable + public Drawable getOverflowIcon() { ensureMenu(); - return mMenuView.getMenu(); + return mMenuView.getOverflowIcon(); } private void ensureMenu() { @@ -950,17 +867,6 @@ public class Toolbar extends ViewGroup { lp.gravity = Gravity.END | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK); mMenuView.setLayoutParams(lp); addSystemView(mMenuView); - - if (mOverflowTintInfo != null) { - // If we have tint info for the overflow, set it on the menu view now - if (mOverflowTintInfo.mHasTintList) { - mMenuView.setOverflowTintList(mOverflowTintInfo.mTintList); - } - if (mOverflowTintInfo.mHasTintMode) { - mMenuView.setOverflowTintMode(mOverflowTintInfo.mTintMode); - } - mOverflowTintInfo = null; - } } } @@ -1114,7 +1020,6 @@ public class Toolbar extends ViewGroup { final LayoutParams lp = generateDefaultLayoutParams(); lp.gravity = Gravity.START | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK); mNavButtonView.setLayoutParams(lp); - applyNavigationTint(); } } @@ -1133,7 +1038,6 @@ public class Toolbar extends ViewGroup { collapseActionView(); } }); - applyNavigationTint(); } } @@ -1885,30 +1789,6 @@ public class Toolbar extends ViewGroup { return mPopupContext; } - private void applyNavigationTint() { - final TintInfo tintInfo = mNavTintInfo; - if (tintInfo != null && (tintInfo.mHasTintList || tintInfo.mHasTintMode)) { - if (mNavButtonView != null) { - if (tintInfo.mHasTintList) { - mNavButtonView.setImageTintList(tintInfo.mTintList); - } - if (tintInfo.mHasTintMode) { - mNavButtonView.setImageTintMode(tintInfo.mTintMode); - } - } - - if (mCollapseButtonView != null) { - // We will use the same tint for the collapse button - if (tintInfo.mHasTintList) { - mCollapseButtonView.setImageTintList(tintInfo.mTintList); - } - if (tintInfo.mHasTintMode) { - mCollapseButtonView.setImageTintMode(tintInfo.mTintMode); - } - } - } - } - /** * Interface responsible for receiving menu item click events if the items themselves * do not have individual item click listeners. @@ -2136,11 +2016,4 @@ public class Toolbar extends ViewGroup { public void onRestoreInstanceState(Parcelable state) { } } - - private static class TintInfo { - ColorStateList mTintList; - PorterDuff.Mode mTintMode; - boolean mHasTintMode; - boolean mHasTintList; - } } diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index ba4af89..39c86f9 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -18,8 +18,6 @@ package com.android.internal.app; import android.app.Activity; import android.app.ActivityThread; -import android.app.usage.UsageStats; -import android.app.usage.UsageStatsManager; import android.os.AsyncTask; import android.provider.Settings; import android.text.TextUtils; @@ -64,14 +62,11 @@ import android.widget.TextView; import android.widget.Toast; import com.android.internal.widget.ResolverDrawerLayout; -import java.text.Collator; import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; @@ -100,10 +95,7 @@ public class ResolverActivity extends Activity { private boolean mResolvingHome = false; private int mProfileSwitchMessageId = -1; private final ArrayList<Intent> mIntents = new ArrayList<>(); - - private UsageStatsManager mUsm; - private Map<String, UsageStats> mStats; - private static final long USAGE_STATS_PERIOD = 1000 * 60 * 60 * 24 * 14; + private ResolverComparator mResolverComparator; private boolean mRegistered; private final PackageMonitor mPackageMonitor = new PackageMonitor() { @@ -222,10 +214,6 @@ public class ResolverActivity extends Activity { } mPm = getPackageManager(); - mUsm = (UsageStatsManager) getSystemService(Context.USAGE_STATS_SERVICE); - - final long sinceTime = System.currentTimeMillis() - USAGE_STATS_PERIOD; - mStats = mUsm.queryAndAggregateUsageStats(sinceTime, System.currentTimeMillis()); mPackageMonitor.register(this, getMainLooper(), false); mRegistered = true; @@ -236,6 +224,10 @@ public class ResolverActivity extends Activity { // Add our initial intent as the first item, regardless of what else has already been added. mIntents.add(0, new Intent(intent)); + final String referrerPackage = getReferrerPackageName(); + + mResolverComparator = new ResolverComparator(this, getTargetIntent(), referrerPackage); + configureContentView(mIntents, initialIntents, rList, alwaysUseOption); // Prevent the Resolver window from becoming the top fullscreen window and thus from taking @@ -265,7 +257,6 @@ public class ResolverActivity extends Activity { // Try to initialize the title icon if we have a view for it and a title to match final ImageView titleIcon = (ImageView) findViewById(R.id.title_icon); if (titleIcon != null) { - final String referrerPackage = getReferrerPackageName(); ApplicationInfo ai = null; try { if (!TextUtils.isEmpty(referrerPackage)) { @@ -1175,8 +1166,8 @@ public class ResolverActivity extends Activity { } } if (N > 1) { - Collections.sort(currentResolveList, - new ResolverComparator(ResolverActivity.this, getTargetIntent())); + mResolverComparator.compute(currentResolveList); + Collections.sort(currentResolveList, mResolverComparator); } // First put the initial items at the top. if (mInitialIntents != null) { @@ -1651,63 +1642,4 @@ public class ResolverActivity extends Activity { && match <= IntentFilter.MATCH_CATEGORY_PATH; } - class ResolverComparator implements Comparator<ResolvedComponentInfo> { - private final Collator mCollator; - private final boolean mHttp; - - public ResolverComparator(Context context, Intent intent) { - mCollator = Collator.getInstance(context.getResources().getConfiguration().locale); - String scheme = intent.getScheme(); - mHttp = "http".equals(scheme) || "https".equals(scheme); - } - - @Override - public int compare(ResolvedComponentInfo lhsp, ResolvedComponentInfo rhsp) { - final ResolveInfo lhs = lhsp.getResolveInfoAt(0); - final ResolveInfo rhs = rhsp.getResolveInfoAt(0); - - // We want to put the one targeted to another user at the end of the dialog. - if (lhs.targetUserId != UserHandle.USER_CURRENT) { - return 1; - } - - if (mHttp) { - // Special case: we want filters that match URI paths/schemes to be - // ordered before others. This is for the case when opening URIs, - // to make native apps go above browsers. - final boolean lhsSpecific = isSpecificUriMatch(lhs.match); - final boolean rhsSpecific = isSpecificUriMatch(rhs.match); - if (lhsSpecific != rhsSpecific) { - return lhsSpecific ? -1 : 1; - } - } - - if (mStats != null) { - final long timeDiff = - getPackageTimeSpent(rhs.activityInfo.packageName) - - getPackageTimeSpent(lhs.activityInfo.packageName); - - if (timeDiff != 0) { - return timeDiff > 0 ? 1 : -1; - } - } - - CharSequence sa = lhs.loadLabel(mPm); - if (sa == null) sa = lhs.activityInfo.name; - CharSequence sb = rhs.loadLabel(mPm); - if (sb == null) sb = rhs.activityInfo.name; - - return mCollator.compare(sa.toString(), sb.toString()); - } - - private long getPackageTimeSpent(String packageName) { - if (mStats != null) { - final UsageStats stats = mStats.get(packageName); - if (stats != null) { - return stats.getTotalTimeInForeground(); - } - } - return 0; - } - } } diff --git a/core/java/com/android/internal/app/ResolverComparator.java b/core/java/com/android/internal/app/ResolverComparator.java new file mode 100644 index 0000000..42668f1 --- /dev/null +++ b/core/java/com/android/internal/app/ResolverComparator.java @@ -0,0 +1,215 @@ +/* + * Copyright (C) 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 may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package com.android.internal.app; + +import android.app.usage.UsageStats; +import android.app.usage.UsageStatsManager; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.ApplicationInfo; +import android.content.pm.ComponentInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.os.UserHandle; +import android.text.TextUtils; +import android.util.Log; +import com.android.internal.app.ResolverActivity.ResolvedComponentInfo; + +import java.text.Collator; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Ranks and compares packages based on usage stats. + */ +class ResolverComparator implements Comparator<ResolvedComponentInfo> { + private static final String TAG = "ResolverComparator"; + + private static final boolean DEBUG = true; + + // Two weeks + private static final long USAGE_STATS_PERIOD = 1000 * 60 * 60 * 24 * 14; + + private static final long RECENCY_TIME_PERIOD = 1000 * 60 * 60 * 12; + + private static final float RECENCY_MULTIPLIER = 3.f; + + private final Collator mCollator; + private final boolean mHttp; + private final PackageManager mPm; + private final UsageStatsManager mUsm; + private final Map<String, UsageStats> mStats; + private final long mCurrentTime; + private final long mSinceTime; + private final LinkedHashMap<ComponentName, ScoredTarget> mScoredTargets = new LinkedHashMap<>(); + private final String mReferrerPackage; + + public ResolverComparator(Context context, Intent intent, String referrerPackage) { + mCollator = Collator.getInstance(context.getResources().getConfiguration().locale); + String scheme = intent.getScheme(); + mHttp = "http".equals(scheme) || "https".equals(scheme); + mReferrerPackage = referrerPackage; + + mPm = context.getPackageManager(); + mUsm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); + + mCurrentTime = System.currentTimeMillis(); + mSinceTime = mCurrentTime - USAGE_STATS_PERIOD; + mStats = mUsm.queryAndAggregateUsageStats(mSinceTime, mCurrentTime); + } + + public void compute(List<ResolvedComponentInfo> targets) { + mScoredTargets.clear(); + + final long recentSinceTime = mCurrentTime - RECENCY_TIME_PERIOD; + + long mostRecentlyUsedTime = recentSinceTime + 1; + long mostTimeSpent = 1; + int mostLaunched = 1; + + for (ResolvedComponentInfo target : targets) { + final ScoredTarget scoredTarget + = new ScoredTarget(target.getResolveInfoAt(0).activityInfo); + mScoredTargets.put(target.name, scoredTarget); + final UsageStats pkStats = mStats.get(target.name.getPackageName()); + if (pkStats != null) { + // Only count recency for apps that weren't the caller + // since the caller is always the most recent. + // Persistent processes muck this up, so omit them too. + if (!target.name.getPackageName().equals(mReferrerPackage) + && !isPersistentProcess(target)) { + final long lastTimeUsed = pkStats.getLastTimeUsed(); + scoredTarget.lastTimeUsed = lastTimeUsed; + if (lastTimeUsed > mostRecentlyUsedTime) { + mostRecentlyUsedTime = lastTimeUsed; + } + } + final long timeSpent = pkStats.getTotalTimeInForeground(); + scoredTarget.timeSpent = timeSpent; + if (timeSpent > mostTimeSpent) { + mostTimeSpent = timeSpent; + } + final int launched = pkStats.mLaunchCount; + scoredTarget.launchCount = launched; + if (launched > mostLaunched) { + mostLaunched = launched; + } + } + } + + + if (DEBUG) { + Log.d(TAG, "compute - mostRecentlyUsedTime: " + mostRecentlyUsedTime + + " mostTimeSpent: " + mostTimeSpent + + " recentSinceTime: " + recentSinceTime + + " mostLaunched: " + mostLaunched); + } + + for (ScoredTarget target : mScoredTargets.values()) { + final float recency = (float) Math.max(target.lastTimeUsed - recentSinceTime, 0) + / (mostRecentlyUsedTime - recentSinceTime); + final float recencyScore = recency * recency * RECENCY_MULTIPLIER; + final float usageTimeScore = (float) target.timeSpent / mostTimeSpent; + final float launchCountScore = (float) target.launchCount / mostLaunched; + + target.score = recencyScore + usageTimeScore + launchCountScore; + if (DEBUG) { + Log.d(TAG, "Scores: recencyScore: " + recencyScore + + " usageTimeScore: " + usageTimeScore + + " launchCountScore: " + launchCountScore + + " - " + target); + } + } + } + + static boolean isPersistentProcess(ResolvedComponentInfo rci) { + if (rci != null && rci.getCount() > 0) { + return (rci.getResolveInfoAt(0).activityInfo.applicationInfo.flags & + ApplicationInfo.FLAG_PERSISTENT) != 0; + } + return false; + } + + @Override + public int compare(ResolvedComponentInfo lhsp, ResolvedComponentInfo rhsp) { + final ResolveInfo lhs = lhsp.getResolveInfoAt(0); + final ResolveInfo rhs = rhsp.getResolveInfoAt(0); + + // We want to put the one targeted to another user at the end of the dialog. + if (lhs.targetUserId != UserHandle.USER_CURRENT) { + return 1; + } + + if (mHttp) { + // Special case: we want filters that match URI paths/schemes to be + // ordered before others. This is for the case when opening URIs, + // to make native apps go above browsers. + final boolean lhsSpecific = ResolverActivity.isSpecificUriMatch(lhs.match); + final boolean rhsSpecific = ResolverActivity.isSpecificUriMatch(rhs.match); + if (lhsSpecific != rhsSpecific) { + return lhsSpecific ? -1 : 1; + } + } + + if (mStats != null) { + final ScoredTarget lhsTarget = mScoredTargets.get(new ComponentName( + lhs.activityInfo.packageName, lhs.activityInfo.name)); + final ScoredTarget rhsTarget = mScoredTargets.get(new ComponentName( + rhs.activityInfo.packageName, rhs.activityInfo.name)); + final float diff = rhsTarget.score - lhsTarget.score; + + if (diff != 0) { + return diff > 0 ? 1 : -1; + } + } + + CharSequence sa = lhs.loadLabel(mPm); + if (sa == null) sa = lhs.activityInfo.name; + CharSequence sb = rhs.loadLabel(mPm); + if (sb == null) sb = rhs.activityInfo.name; + + return mCollator.compare(sa.toString().trim(), sb.toString().trim()); + } + + static class ScoredTarget { + public final ComponentInfo componentInfo; + public float score; + public long lastTimeUsed; + public long timeSpent; + public long launchCount; + + public ScoredTarget(ComponentInfo ci) { + componentInfo = ci; + } + + @Override + public String toString() { + return "ScoredTarget{" + componentInfo + + " score: " + score + + " lastTimeUsed: " + lastTimeUsed + + " timeSpent: " + timeSpent + + " launchCount: " + launchCount + + "}"; + } + } +} diff --git a/core/java/com/android/internal/view/menu/ActionMenuItem.java b/core/java/com/android/internal/view/menu/ActionMenuItem.java index 00af401..ed676bb 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuItem.java +++ b/core/java/com/android/internal/view/menu/ActionMenuItem.java @@ -18,8 +18,6 @@ package com.android.internal.view.menu; import android.content.Context; import android.content.Intent; -import android.content.res.ColorStateList; -import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.view.ActionProvider; import android.view.ContextMenu.ContextMenuInfo; @@ -44,7 +42,6 @@ public class ActionMenuItem implements MenuItem { private Drawable mIconDrawable; private int mIconResId = NO_ICON; - private TintInfo mIconTintInfo; private Context mContext; @@ -161,14 +158,12 @@ public class ActionMenuItem implements MenuItem { public MenuItem setIcon(Drawable icon) { mIconDrawable = icon; mIconResId = NO_ICON; - applyIconTint(); return this; } public MenuItem setIcon(int iconRes) { mIconResId = iconRes; mIconDrawable = mContext.getDrawable(iconRes); - applyIconTint(); return this; } @@ -279,48 +274,4 @@ public class ActionMenuItem implements MenuItem { // No need to save the listener; ActionMenuItem does not support collapsing items. return this; } - - @Override - public MenuItem setIconTintList(ColorStateList tintList) { - if (mIconTintInfo == null) { - mIconTintInfo = new TintInfo(); - } - mIconTintInfo.mTintList = tintList; - mIconTintInfo.mHasTintList = true; - applyIconTint(); - return this; - } - - @Override - public MenuItem setIconTintMode(PorterDuff.Mode tintMode) { - if (mIconTintInfo == null) { - mIconTintInfo = new TintInfo(); - } - mIconTintInfo.mTintMode = tintMode; - mIconTintInfo.mHasTintMode = true; - applyIconTint(); - return this; - } - - private void applyIconTint() { - final TintInfo tintInfo = mIconTintInfo; - if (mIconDrawable != null && tintInfo != null) { - if (tintInfo.mHasTintList || tintInfo.mHasTintMode) { - mIconDrawable = mIconDrawable.mutate(); - if (tintInfo.mHasTintList) { - mIconDrawable.setTintList(tintInfo.mTintList); - } - if (tintInfo.mHasTintMode) { - mIconDrawable.setTintMode(tintInfo.mTintMode); - } - } - } - } - - private static class TintInfo { - ColorStateList mTintList; - PorterDuff.Mode mTintMode; - boolean mHasTintMode; - boolean mHasTintList; - } } diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java index ef4e546..3b1f20d 100644 --- a/core/java/com/android/internal/view/menu/MenuItemImpl.java +++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java @@ -21,8 +21,6 @@ import com.android.internal.view.menu.MenuView.ItemView; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; -import android.content.res.ColorStateList; -import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.ActionProvider; @@ -62,11 +60,6 @@ public final class MenuItemImpl implements MenuItem { * needed). */ private int mIconResId = NO_ICON; - - /** - * Tint info for the icon - */ - private TintInfo mIconTintInfo; /** The menu to which this item belongs */ private MenuBuilder mMenu; @@ -392,10 +385,10 @@ public final class MenuItemImpl implements MenuItem { } if (mIconResId != NO_ICON) { - mIconDrawable = mMenu.getContext().getDrawable(mIconResId); + Drawable icon = mMenu.getContext().getDrawable(mIconResId); mIconResId = NO_ICON; - applyIconTint(); - return mIconDrawable; + mIconDrawable = icon; + return icon; } return null; @@ -404,7 +397,6 @@ public final class MenuItemImpl implements MenuItem { public MenuItem setIcon(Drawable icon) { mIconResId = NO_ICON; mIconDrawable = icon; - applyIconTint(); mMenu.onItemsChanged(false); return this; @@ -678,48 +670,4 @@ public final class MenuItemImpl implements MenuItem { public boolean isActionViewExpanded() { return mIsActionViewExpanded; } - - @Override - public MenuItem setIconTintList(ColorStateList tintList) { - if (mIconTintInfo == null) { - mIconTintInfo = new TintInfo(); - } - mIconTintInfo.mTintList = tintList; - mIconTintInfo.mHasTintList = true; - applyIconTint(); - return this; - } - - @Override - public MenuItem setIconTintMode(PorterDuff.Mode tintMode) { - if (mIconTintInfo == null) { - mIconTintInfo = new TintInfo(); - } - mIconTintInfo.mTintMode = tintMode; - mIconTintInfo.mHasTintMode = true; - applyIconTint(); - return this; - } - - private void applyIconTint() { - final TintInfo tintInfo = mIconTintInfo; - if (mIconDrawable != null && tintInfo != null) { - if (tintInfo.mHasTintList || tintInfo.mHasTintMode) { - mIconDrawable = mIconDrawable.mutate(); - if (tintInfo.mHasTintList) { - mIconDrawable.setTintList(tintInfo.mTintList); - } - if (tintInfo.mHasTintMode) { - mIconDrawable.setTintMode(tintInfo.mTintMode); - } - } - } - } - - private static class TintInfo { - ColorStateList mTintList; - PorterDuff.Mode mTintMode; - boolean mHasTintMode; - boolean mHasTintList; - } } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 709de9e..0911d42 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1979,6 +1979,10 @@ <permission android:name="android.permission.GRANT_REVOKE_PERMISSIONS" android:protectionLevel="signature" /> + <!-- @hide Allows an application to observe permission changes. --> + <permission android:name="android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS" + android:protectionLevel="signatureOrSystem" /> + <!-- Allows an application to use SurfaceFlinger's low level features. <p>Not for use by third-party applications. --> <permission android:name="android.permission.ACCESS_SURFACE_FLINGER" diff --git a/core/res/res/drawable-hdpi/ic_fingerprint_light_overlay.png b/core/res/res/drawable-hdpi/ic_fingerprint_light_overlay.png Binary files differdeleted file mode 100644 index 0253c77..0000000 --- a/core/res/res/drawable-hdpi/ic_fingerprint_light_overlay.png +++ /dev/null diff --git a/core/res/res/drawable-mdpi/ic_fingerprint_light_overlay.png b/core/res/res/drawable-mdpi/ic_fingerprint_light_overlay.png Binary files differdeleted file mode 100644 index 5a1c61e..0000000 --- a/core/res/res/drawable-mdpi/ic_fingerprint_light_overlay.png +++ /dev/null diff --git a/core/res/res/drawable-xhdpi/ic_fingerprint_light_overlay.png b/core/res/res/drawable-xhdpi/ic_fingerprint_light_overlay.png Binary files differdeleted file mode 100644 index 5f0c362..0000000 --- a/core/res/res/drawable-xhdpi/ic_fingerprint_light_overlay.png +++ /dev/null diff --git a/core/res/res/drawable-xxhdpi/ic_fingerprint_light_overlay.png b/core/res/res/drawable-xxhdpi/ic_fingerprint_light_overlay.png Binary files differdeleted file mode 100644 index f4cf906..0000000 --- a/core/res/res/drawable-xxhdpi/ic_fingerprint_light_overlay.png +++ /dev/null diff --git a/core/res/res/drawable-xxxhdpi/ic_fingerprint_light_overlay.png b/core/res/res/drawable-xxxhdpi/ic_fingerprint_light_overlay.png Binary files differdeleted file mode 100644 index dcdbed9..0000000 --- a/core/res/res/drawable-xxxhdpi/ic_fingerprint_light_overlay.png +++ /dev/null diff --git a/core/res/res/drawable/ic_fingerprint.xml b/core/res/res/drawable/ic_fingerprint.xml new file mode 100644 index 0000000..c19f00f --- /dev/null +++ b/core/res/res/drawable/ic_fingerprint.xml @@ -0,0 +1,37 @@ +<!-- + ~ Copyright (C) 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 may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24.0dp" + android:height="24.0dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#ffffff" + android:pathData="M17.5,4.47c-0.08,0.0 -0.16,-0.02 -0.24,-0.06C15.45,3.42 13.88,3.0 12.01,3.0c-1.87,0.0 -3.64,0.47 -5.25,1.4C6.52,4.54 6.22,4.46 6.08,4.22C5.94,3.98 6.02,3.67 6.26,3.54C8.03,2.52 9.96,2.0 12.01,2.0c2.02,0.0 3.79,0.47 5.73,1.53c0.24,0.13 0.33,0.44 0.2,0.68C17.85,4.38 17.68,4.47 17.5,4.47z"/> + <path + android:fillColor="#ffffff" + android:pathData="M3.95,9.72c-0.1,0.0 -0.19,-0.03 -0.28,-0.08C3.44,9.48 3.38,9.17 3.54,8.94c0.94,-1.4 2.14,-2.5 3.56,-3.28c2.99,-1.63 6.82,-1.63 9.81,-0.01c1.42,0.77 2.61,1.87 3.56,3.26c0.15,0.23 0.09,0.54 -0.13,0.69c-0.23,0.16 -0.54,0.09 -0.69,-0.13c-0.85,-1.26 -1.93,-2.24 -3.2,-2.94c-2.7,-1.47 -6.16,-1.46 -8.86,0.01C6.3,7.24 5.22,8.23 4.37,9.5C4.27,9.64 4.11,9.72 3.95,9.72z"/> + <path + android:fillColor="#ffffff" + android:pathData="M9.86,21.79c-0.13,0.0 -0.27,-0.05 -0.36,-0.16c-0.82,-0.87 -1.26,-1.43 -1.9,-2.63c-0.65,-1.23 -1.0,-2.73 -1.0,-4.33c0.0,-2.97 2.42,-5.39 5.39,-5.39s5.39,2.42 5.39,5.39c0.0,0.28 -0.22,0.5 -0.5,0.5s-0.5,-0.22 -0.5,-0.5c0.0,-2.42 -1.97,-4.39 -4.39,-4.39S7.6,12.24 7.6,14.66c0.0,1.44 0.3,2.78 0.88,3.86c0.61,1.15 1.02,1.64 1.75,2.42c0.19,0.2 0.18,0.52 -0.02,0.71C10.11,21.74 9.98,21.79 9.86,21.79z"/> + <path + android:fillColor="#ffffff" + android:pathData="M16.7,19.94c-1.14,0.0 -2.13,-0.3 -2.96,-0.89c-1.41,-1.01 -2.25,-2.65 -2.25,-4.38c0.0,-0.28 0.22,-0.5 0.5,-0.5s0.5,0.22 0.5,0.5c0.0,1.41 0.69,2.75 1.83,3.57c0.66,0.48 1.44,0.71 2.38,0.71c0.23,0.0 0.6,-0.02 0.98,-0.1c0.27,-0.05 0.53,0.13 0.58,0.4c0.05,0.27 -0.13,0.53 -0.4,0.58C17.3,19.93 16.83,19.94 16.7,19.94z"/> + <path + android:fillColor="#ffffff" + android:pathData="M14.76,22.0c-0.05,0.0 -0.09,-0.01 -0.14,-0.02c-1.51,-0.44 -2.51,-1.03 -3.53,-2.11c-1.32,-1.39 -2.05,-3.24 -2.05,-5.21c0.0,-1.62 1.32,-2.94 2.94,-2.94c1.62,0.0 2.94,1.32 2.94,2.94c0.0,1.07 0.87,1.94 1.94,1.94s1.94,-0.87 1.94,-1.94c0.0,-3.77 -3.07,-6.83 -6.83,-6.83c-2.68,0.0 -5.12,1.58 -6.23,4.02c-0.37,0.81 -0.56,1.76 -0.56,2.81c0.0,0.78 0.07,2.01 0.63,3.61c0.09,0.26 -0.04,0.55 -0.3,0.64c-0.26,0.09 -0.55,-0.04 -0.64,-0.3c-0.46,-1.31 -0.69,-2.6 -0.69,-3.95c0.0,-1.2 0.22,-2.28 0.65,-3.23c1.27,-2.8 4.07,-4.61 7.14,-4.61c4.32,0.0 7.83,3.51 7.83,7.83c0.0,1.62 -1.32,2.94 -2.94,2.94c-1.62,0.0 -2.94,-1.32 -2.94,-2.94c0.0,-1.07 -0.87,-1.94 -1.94,-1.94s-1.94,0.87 -1.94,1.94c0.0,1.71 0.63,3.32 1.77,4.52c0.9,0.95 1.74,1.45 3.08,1.84c0.27,0.08 0.42,0.35 0.34,0.62C15.18,21.86 14.98,22.0 14.76,22.0z"/> +</vector> diff --git a/core/res/res/drawable/ic_fingerprint_dark.xml b/core/res/res/drawable/ic_fingerprint_dark.xml deleted file mode 100644 index 6eb6ada..0000000 --- a/core/res/res/drawable/ic_fingerprint_dark.xml +++ /dev/null @@ -1,37 +0,0 @@ -<!-- - ~ Copyright (C) 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 may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="32.0dp" - android:height="32.0dp" - android:viewportWidth="32.0" - android:viewportHeight="32.0"> - <path - android:fillColor="?attr/colorControlNormal" - android:pathData="M23.7,5.9c-0.1,0.0 -0.2,0.0 -0.3,-0.1C21.0,4.5 18.6,3.9 16.0,3.9c-2.5,0.0 -4.6,0.6 -6.9,1.9C8.8,6.0 8.3,5.9 8.1,5.5C7.9,5.2 8.0,4.7 8.4,4.5c2.5,-1.4 4.9,-2.1 7.7,-2.1c2.8,0.0 5.4,0.7 8.0,2.1c0.4,0.2 0.5,0.6 0.3,1.0C24.2,5.7 24.0,5.9 23.7,5.9z"/> - <path - android:fillColor="?attr/colorControlNormal" - android:pathData="M5.3,13.2c-0.1,0.0 -0.3,0.0 -0.4,-0.1c-0.3,-0.2 -0.4,-0.7 -0.2,-1.0c1.3,-1.9 2.9,-3.4 4.9,-4.5c4.1,-2.2 9.3,-2.2 13.4,0.0c1.9,1.1 3.6,2.5 4.9,4.4c0.2,0.3 0.1,0.8 -0.2,1.0c-0.3,0.2 -0.8,0.1 -1.0,-0.2c-1.2,-1.7 -2.6,-3.0 -4.3,-4.0c-3.7,-2.0 -8.3,-2.0 -12.0,0.0c-1.7,0.9 -3.2,2.3 -4.3,4.0C5.7,13.1 5.5,13.2 5.3,13.2z"/> - <path - android:fillColor="?attr/colorControlNormal" - android:pathData="M13.3,29.6c-0.2,0.0 -0.4,-0.1 -0.5,-0.2c-1.1,-1.2 -1.7,-2.0 -2.6,-3.6c-0.9,-1.7 -1.4,-3.7 -1.4,-5.9c0.0,-4.1 3.3,-7.4 7.4,-7.4c4.1,0.0 7.4,3.3 7.4,7.4c0.0,0.4 -0.3,0.7 -0.7,0.7s-0.7,-0.3 -0.7,-0.7c0.0,-3.3 -2.7,-5.9 -5.9,-5.9c-3.3,0.0 -5.9,2.7 -5.9,5.9c0.0,2.0 0.4,3.8 1.2,5.2c0.8,1.6 1.4,2.2 2.4,3.3c0.3,0.3 0.3,0.8 0.0,1.0C13.7,29.5 13.5,29.6 13.3,29.6z"/> - <path - android:fillColor="?attr/colorControlNormal" - android:pathData="M22.6,27.1c-1.6,0.0 -2.9,-0.4 -4.1,-1.2c-1.9,-1.4 -3.1,-3.6 -3.1,-6.0c0.0,-0.4 0.3,-0.7 0.7,-0.7s0.7,0.3 0.7,0.7c0.0,1.9 0.9,3.7 2.5,4.8c0.9,0.6 1.9,1.0 3.2,1.0c0.3,0.0 0.8,0.0 1.3,-0.1c0.4,-0.1 0.8,0.2 0.8,0.6c0.1,0.4 -0.2,0.8 -0.6,0.8C23.4,27.1 22.8,27.1 22.6,27.1z"/> - <path - android:fillColor="?attr/colorControlNormal" - android:pathData="M20.0,29.9c-0.1,0.0 -0.1,0.0 -0.2,0.0c-2.1,-0.6 -3.4,-1.4 -4.8,-2.9c-1.8,-1.9 -2.8,-4.4 -2.8,-7.1c0.0,-2.2 1.8,-4.1 4.1,-4.1c2.2,0.0 4.1,1.8 4.1,4.1c0.0,1.4 1.2,2.6 2.6,2.6c1.4,0.0 2.6,-1.2 2.6,-2.6c0.0,-5.1 -4.2,-9.3 -9.3,-9.3c-3.6,0.0 -6.9,2.1 -8.4,5.4C7.3,17.1 7.0,18.4 7.0,19.8c0.0,1.1 0.1,2.7 0.9,4.9c0.1,0.4 -0.1,0.8 -0.4,0.9c-0.4,0.1 -0.8,-0.1 -0.9,-0.4c-0.6,-1.8 -0.9,-3.6 -0.9,-5.4c0.0,-1.6 0.3,-3.1 0.9,-4.4c1.7,-3.8 5.6,-6.3 9.8,-6.3c5.9,0.0 10.7,4.8 10.7,10.7c0.0,2.2 -1.8,4.1 -4.1,4.1s-4.0,-1.8 -4.0,-4.1c0.0,-1.4 -1.2,-2.6 -2.6,-2.6c-1.4,0.0 -2.6,1.2 -2.6,2.6c0.0,2.3 0.9,4.5 2.4,6.1c1.2,1.3 2.4,2.0 4.2,2.5c0.4,0.1 0.6,0.5 0.5,0.9C20.6,29.7 20.3,29.9 20.0,29.9z"/> -</vector> diff --git a/core/res/res/drawable/ic_fingerprint_light.xml b/core/res/res/drawable/ic_fingerprint_light.xml deleted file mode 100644 index 223d16b..0000000 --- a/core/res/res/drawable/ic_fingerprint_light.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - Copyright (C) 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 may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - <item> - <shape android:shape="oval"> - <solid android:color="?attr/colorAccent"/> - <size - android:width="40dp" - android:height="40dp"/> - </shape> - </item> - <item> - <bitmap android:src="@drawable/ic_fingerprint_light_overlay"/> - </item> -</layer-list> diff --git a/core/res/res/layout/seekbar_dialog.xml b/core/res/res/layout/preference_dialog_seekbar.xml index 84352a5..4e366c4 100644 --- a/core/res/res/layout/seekbar_dialog.xml +++ b/core/res/res/layout/preference_dialog_seekbar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2008 The Android Open Source Project +<!-- Copyright (C) 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. @@ -15,20 +15,21 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:orientation="vertical"> + + <ImageView + android:id="@+id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingTop="20dp" /> + + <SeekBar + android:id="@+id/seekbar" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:gravity="center_horizontal"> - - <ImageView android:id="@+id/icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingTop="20dip" /> - - <SeekBar android:id="@+id/seekbar" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="20dip" /> - + android:layout_height="wrap_content" + android:padding="20dp" /> + </LinearLayout> - diff --git a/core/res/res/layout/preference_dialog_seekbar_material.xml b/core/res/res/layout/preference_dialog_seekbar_material.xml new file mode 100644 index 0000000..a98a995 --- /dev/null +++ b/core/res/res/layout/preference_dialog_seekbar_material.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 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 may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:orientation="vertical"> + + <ImageView + android:id="@+id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingTop="?attr/dialogPreferredPadding" /> + + <SeekBar + android:id="@+id/seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="?attr/dialogPreferredPadding" + android:paddingStart="?attr/dialogPreferredPadding" + android:paddingEnd="?attr/dialogPreferredPadding" /> + +</LinearLayout> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index a13f494..52e2cf0 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -561,15 +561,18 @@ <!-- Image elements --> <!-- ============== --> <eat-comment /> - +i <!-- Background that can be used behind parts of a UI that provide details on data the user is selecting. For example, this is the background element of PreferenceActivity's embedded preference fragment. --> <attr name="detailsElementBackground" format="reference" /> - <!-- Drawable that should be used to indicate that an app is waiting for a fingerprint scan. --> - <attr name="fingerprintDrawable" format="reference" /> + <!-- Icon that should be used to indicate that an app is waiting for a fingerprint scan. + This should be used whenever an app is requesting the user to place a finger on the + fingerprint sensor. It can be combined with other drawables such as colored circles, so + the appearance matches the branding of the app requesting the fingerprint scan.--> + <attr name="fingerprintAuthDrawable" format="reference" /> <!-- ============ --> <!-- Panel styles --> @@ -868,6 +871,8 @@ <attr name="dialogPreferenceStyle" format="reference" /> <!-- Default style for EditTextPreference. --> <attr name="editTextPreferenceStyle" format="reference" /> + <!-- @hide Default style for SeekBarDialogPreference. --> + <attr name="seekBarDialogPreferenceStyle" format="reference" /> <!-- Default style for RingtonePreference. --> <attr name="ringtonePreferenceStyle" format="reference" /> <!-- The preference layout that has the child/tabbed effect. --> @@ -6646,33 +6651,6 @@ for more info. --> <attr name="actionProviderClass" format="string" /> - <!-- An optional tint for the item's icon. - See {@link android.view.MenuItem#setIconTintList(android.content.res.ColorStateList)} - for more info. --> - <attr name="iconTint" format="color" /> - - <!-- The blending mode used for tinting the item's icon - See {@link android.view.MenuItem#setIconTintMode(android.graphics.PorterDuff.Mode)} - for more info. --> - <attr name="iconTintMode"> - <!-- The tint is drawn on top of the drawable. - [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] --> - <enum name="src_over" value="3" /> - <!-- The tint is masked by the alpha channel of the drawable. The drawable’s - color channels are thrown out. [Sa * Da, Sc * Da] --> - <enum name="src_in" value="5" /> - <!-- The tint is drawn above the drawable, but with the drawable’s alpha - channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] --> - <enum name="src_atop" value="9" /> - <!-- Multiplies the color and alpha channels of the drawable with those of - the tint. [Sa * Da, Sc * Dc] --> - <enum name="multiply" value="14" /> - <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] --> - <enum name="screen" value="15" /> - <!-- Combines the tint and drawable color and alpha channels, clamping the - result to valid color values. Saturate(S + D) --> - <enum name="add" value="16" /> - </attr> </declare-styleable> <!-- Attrbitutes for a ActvityChooserView. --> @@ -7786,52 +7764,6 @@ <!-- Text to set as the content description for the navigation button located at the start of the toolbar. --> <attr name="navigationContentDescription" format="string" /> - - <!-- Tint used for the navigation button --> - <attr name="navigationTint" format="color" /> - <!-- The blending mode used for tinting the navigation button --> - <attr name="navigationTintMode"> - <!-- The tint is drawn on top of the drawable. - [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] --> - <enum name="src_over" value="3" /> - <!-- The tint is masked by the alpha channel of the drawable. The drawable’s - color channels are thrown out. [Sa * Da, Sc * Da] --> - <enum name="src_in" value="5" /> - <!-- The tint is drawn above the drawable, but with the drawable’s alpha - channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] --> - <enum name="src_atop" value="9" /> - <!-- Multiplies the color and alpha channels of the drawable with those of - the tint. [Sa * Da, Sc * Dc] --> - <enum name="multiply" value="14" /> - <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] --> - <enum name="screen" value="15" /> - <!-- Combines the tint and drawable color and alpha channels, clamping the - result to valid color values. Saturate(S + D). Only works on APIv 11+ --> - <enum name="add" value="16" /> - </attr> - - <!-- Tint used for the overflow button --> - <attr name="overflowTint" format="color" /> - <!-- The blending mode used for tinting the overflow button --> - <attr name="overflowTintMode"> - <!-- The tint is drawn on top of the drawable. - [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] --> - <enum name="src_over" value="3" /> - <!-- The tint is masked by the alpha channel of the drawable. The drawable’s - color channels are thrown out. [Sa * Da, Sc * Da] --> - <enum name="src_in" value="5" /> - <!-- The tint is drawn above the drawable, but with the drawable’s alpha - channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] --> - <enum name="src_atop" value="9" /> - <!-- Multiplies the color and alpha channels of the drawable with those of - the tint. [Sa * Da, Sc * Dc] --> - <enum name="multiply" value="14" /> - <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] --> - <enum name="screen" value="15" /> - <!-- Combines the tint and drawable color and alpha channels, clamping the - result to valid color values. Saturate(S + D). Only works on APIv 11+ --> - <enum name="add" value="16" /> - </attr> </declare-styleable> <declare-styleable name="Toolbar_LayoutParams"> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index bbf4005..bbe27a4 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2614,12 +2614,20 @@ <public type="attr" name="end" /> <public type="attr" name="windowLightStatusBar" /> <public type="attr" name="numbersInnerTextColor" /> - <public type="attr" name="iconTint" /> - <public type="attr" name="iconTintMode" /> - <public type="attr" name="overflowTint" /> - <public type="attr" name="overflowTintMode" /> - <public type="attr" name="navigationTint" /> - <public type="attr" name="navigationTintMode" /> + + <attr name="__reserved2" format="boolean" /> + <public type="attr" name="__reserved2" /> + <attr name="__reserved3" format="boolean" /> + <public type="attr" name="__reserved3" /> + <attr name="__reserved4" format="boolean" /> + <public type="attr" name="__reserved4" /> + <attr name="__reserved5" format="boolean" /> + <public type="attr" name="__reserved5" /> + <attr name="__reserved6" format="boolean" /> + <public type="attr" name="__reserved6" /> + <attr name="__reserved7" format="boolean" /> + <public type="attr" name="__reserved7" /> + <public type="attr" name="fullBackupContent" /> <public type="style" name="Widget.Material.Button.Colored" /> @@ -2690,5 +2698,5 @@ <public type="attr" name="supportsLaunchVoiceAssistFromKeyguard" /> <public type="attr" name="scrollIndicators" /> <public type="attr" name="hyphenationFrequency" /> - <public type="attr" name="fingerprintDrawable" /> + <public type="attr" name="fingerprintAuthDrawable" /> </resources> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 2326968..28274ae 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1519,10 +1519,10 @@ <string name="policylab_disableCamera">Disable cameras</string> <!-- Description of policy access to disable all device cameras [CHAR LIMIT=110]--> <string name="policydesc_disableCamera">Prevent use of all device cameras.</string> - <!-- Title of policy access to disable all device cameras [CHAR LIMIT=30]--> - <string name="policylab_disableKeyguardFeatures">Disable features of screen lock</string> - <!-- Description of policy access to disable all device cameras [CHAR LIMIT=110]--> - <string name="policydesc_disableKeyguardFeatures">Prevent use of some features of screen lock.</string> + <!-- Title of policy access to disable keyguard features [CHAR LIMIT=30]--> + <string name="policylab_disableKeyguardFeatures">Disable some screen lock features</string> + <!-- Description of policy access to disable keyguard features. [CHAR LIMIT=110]--> + <string name="policydesc_disableKeyguardFeatures">Prevent use of some screen lock features.</string> <!-- The order of these is important, don't reorder without changing Contacts.java --> <skip /> <!-- Phone number types from android.provider.Contacts. This could be used when adding a new phone number for a contact, for example. --> @@ -3028,9 +3028,14 @@ <string name="ext_media_ready_notification_message">For transferring photos and media</string> <!-- Notification title when external media is unmountable (corrupt) [CHAR LIMIT=30] --> - <string name="ext_media_unmountable_notification_title">Damaged <xliff:g id="name" example="SD card">%s</xliff:g></string> + <string name="ext_media_unmountable_notification_title">Corrupted <xliff:g id="name" example="SD card">%s</xliff:g></string> <!-- Notification body when external media is unmountable (corrupt) [CHAR LIMIT=NONE] --> - <string name="ext_media_unmountable_notification_message"><xliff:g id="name" example="SD card">%s</xliff:g> is damaged; try reformatting it</string> + <string name="ext_media_unmountable_notification_message"><xliff:g id="name" example="SD card">%s</xliff:g> is corrupt. Touch to fix.</string> + + <!-- Notification title when external media is unsupported [CHAR LIMIT=30] --> + <string name="ext_media_unsupported_notification_title">Unsupported <xliff:g id="name" example="SD card">%s</xliff:g></string> + <!-- Notification body when external media is unsupported [CHAR LIMIT=NONE] --> + <string name="ext_media_unsupported_notification_message">This device doesn\u2019t support this <xliff:g id="name" example="SD card">%s</xliff:g>. Touch to set up in a supported format.</string> <!-- Notification title when external media is unsafely removed [CHAR LIMIT=30] --> <string name="ext_media_badremoval_notification_title"><xliff:g id="name" example="SD card">%s</xliff:g> unexpectedly removed</string> @@ -3048,7 +3053,7 @@ <string name="ext_media_unmounting_notification_message">Don\'t remove</string> <!-- Notification action to setup external media [CHAR LIMIT=20] --> - <string name="ext_media_init_action">Setup</string> + <string name="ext_media_init_action">Set up</string> <!-- Notification action to unmount external media [CHAR LIMIT=20] --> <string name="ext_media_unmount_action">Eject</string> <!-- Notification action to browse external media [CHAR LIMIT=20] --> @@ -3074,6 +3079,29 @@ <!-- Notification title when moving data to external storage failed [CHAR LIMIT=64] --> <string name="ext_media_move_failure_message">Data left at original location</string> + <!-- Short summary of storage media status when removed [CHAR LIMIT=32] --> + <string name="ext_media_status_removed">Removed</string> + <!-- Short summary of storage media status when unmounted [CHAR LIMIT=32] --> + <string name="ext_media_status_unmounted">Ejected</string> + <!-- Short summary of storage media status when checking [CHAR LIMIT=32] --> + <string name="ext_media_status_checking">Checking\u2026</string> + <!-- Short summary of storage media status when mounted [CHAR LIMIT=32] --> + <string name="ext_media_status_mounted">Ready</string> + <!-- Short summary of storage media status when mounted read-only [CHAR LIMIT=32] --> + <string name="ext_media_status_mounted_ro">Read-only</string> + <!-- Short summary of storage media status when removed unsafely [CHAR LIMIT=32] --> + <string name="ext_media_status_bad_removal">Removed unsafely</string> + <!-- Short summary of storage media status when unmountable [CHAR LIMIT=32] --> + <string name="ext_media_status_unmountable">Corrupted</string> + <!-- Short summary of storage media status when unsupported [CHAR LIMIT=32] --> + <string name="ext_media_status_unsupported">Unsupported</string> + <!-- Short summary of storage media status when ejecting [CHAR LIMIT=32] --> + <string name="ext_media_status_ejecting">Ejecting\u2026</string> + <!-- Short summary of storage media status when formatting [CHAR LIMIT=32] --> + <string name="ext_media_status_formatting">Formatting\u2026</string> + <!-- Short summary of storage media status when missing [CHAR LIMIT=32] --> + <string name="ext_media_status_missing">Not inserted</string> + <!-- Shown in LauncherActivity when the requested target Intent didn't return any matching Activities, leaving the list empty. --> <string name="activity_list_empty">No matching activities found.</string> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 4eba117..4bad16d 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -1017,6 +1017,10 @@ please see styles_device_defaults.xml. <item name="negativeButtonText">@string/no</item> </style> + <style name="Preference.DialogPreference.SeekBarPreference"> + <item name="dialogLayout">@layout/preference_dialog_seekbar</item> + </style> + <style name="Preference.DialogPreference.EditTextPreference"> <item name="dialogLayout">@layout/preference_dialog_edittext</item> </style> diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index df4106e..70f9c02 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -87,6 +87,10 @@ please see styles_device_defaults.xml. <item name="negativeButtonText">@string/no</item> </style> + <style name="Preference.Material.DialogPreference.SeekBarPreference"> + <item name="dialogLayout">@layout/preference_dialog_seekbar_material</item> + </style> + <style name="Preference.Material.DialogPreference.EditTextPreference"> <item name="dialogLayout">@layout/preference_dialog_edittext_material</item> </style> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 15b253d..8900688 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1341,7 +1341,6 @@ <java-symbol type="layout" name="preference_widget_seekbar" /> <java-symbol type="layout" name="progress_dialog" /> <java-symbol type="layout" name="resolve_list_item" /> - <java-symbol type="layout" name="seekbar_dialog" /> <java-symbol type="layout" name="select_dialog_singlechoice_holo" /> <java-symbol type="layout" name="ssl_certificate" /> <java-symbol type="layout" name="tab_content" /> @@ -2292,4 +2291,20 @@ <java-symbol type="string" name="config_radio_access_family" /> <java-symbol type="string" name="notification_inbox_ellipsis" /> <java-symbol type="bool" name="config_mainBuiltInDisplayIsRound" /> + + <java-symbol type="attr" name="seekBarDialogPreferenceStyle" /> + <java-symbol type="string" name="ext_media_status_removed" /> + <java-symbol type="string" name="ext_media_status_unmounted" /> + <java-symbol type="string" name="ext_media_status_checking" /> + <java-symbol type="string" name="ext_media_status_mounted" /> + <java-symbol type="string" name="ext_media_status_mounted_ro" /> + <java-symbol type="string" name="ext_media_status_bad_removal" /> + <java-symbol type="string" name="ext_media_status_unmountable" /> + <java-symbol type="string" name="ext_media_status_unsupported" /> + <java-symbol type="string" name="ext_media_status_ejecting" /> + <java-symbol type="string" name="ext_media_status_formatting" /> + <java-symbol type="string" name="ext_media_status_missing" /> + <java-symbol type="string" name="ext_media_unsupported_notification_message" /> + <java-symbol type="string" name="ext_media_unsupported_notification_title" /> + </resources> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 9e87b4d..ecf00f0 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -331,6 +331,7 @@ please see themes_device_defaults.xml. <item name="seekBarPreferenceStyle">@style/Preference.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@style/Preference.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@style/Preference.DialogPreference</item> + <item name="seekBarDialogPreferenceStyle">@style/Preference.DialogPreference.SeekBarPreference</item> <item name="editTextPreferenceStyle">@style/Preference.DialogPreference.EditTextPreference</item> <item name="ringtonePreferenceStyle">@style/Preference.RingtonePreference</item> <item name="preferenceLayoutChild">@layout/preference_child</item> @@ -386,6 +387,7 @@ please see themes_device_defaults.xml. <item name="buttonBarNegativeButtonStyle">?attr/buttonBarButtonStyle</item> <item name="buttonBarNeutralButtonStyle">?attr/buttonBarButtonStyle</item> <item name="segmentedButtonStyle">@style/SegmentedButton</item> + <item name="fingerprintAuthDrawable">@drawable/ic_fingerprint</item> <!-- SearchView attributes --> <item name="searchViewStyle">@style/Widget.Holo.SearchView</item> diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 9f3668d..295b453 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -295,6 +295,7 @@ please see themes_device_defaults.xml. <item name="seekBarPreferenceStyle">@style/Preference.Material.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@style/Preference.Material.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@style/Preference.Material.DialogPreference</item> + <item name="seekBarDialogPreferenceStyle">@style/Preference.Material.DialogPreference.SeekBarPreference</item> <item name="editTextPreferenceStyle">@style/Preference.Material.DialogPreference.EditTextPreference</item> <item name="ringtonePreferenceStyle">@style/Preference.Material.RingtonePreference</item> <item name="preferenceLayoutChild">@layout/preference_child_material</item> @@ -304,7 +305,6 @@ please see themes_device_defaults.xml. <item name="preferenceFragmentListStyle">@style/PreferenceFragmentList.Material</item> <item name="preferenceFragmentPaddingSide">@dimen/preference_fragment_padding_side_material</item> <item name="detailsElementBackground">?attr/colorBackground</item> - <item name="fingerprintDrawable">@drawable/ic_fingerprint_dark</item> <!-- PreferenceFrameLayout attributes --> <item name="preferenceFrameLayoutStyle">@style/Widget.Material.PreferenceFrameLayout</item> @@ -651,6 +651,7 @@ please see themes_device_defaults.xml. <item name="seekBarPreferenceStyle">@style/Preference.Material.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@style/Preference.Material.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@style/Preference.Material.DialogPreference</item> + <item name="seekBarDialogPreferenceStyle">@style/Preference.Material.DialogPreference.SeekBarPreference</item> <item name="editTextPreferenceStyle">@style/Preference.Material.DialogPreference.EditTextPreference</item> <item name="ringtonePreferenceStyle">@style/Preference.Material.RingtonePreference</item> <item name="preferenceLayoutChild">@layout/preference_child_material</item> @@ -660,7 +661,6 @@ please see themes_device_defaults.xml. <item name="preferenceFragmentListStyle">@style/PreferenceFragmentList.Material</item> <item name="preferenceFragmentPaddingSide">@dimen/preference_fragment_padding_side_material</item> <item name="detailsElementBackground">?attr/colorBackground</item> - <item name="fingerprintDrawable">@drawable/ic_fingerprint_light</item> <!-- PreferenceFrameLayout attributes --> <item name="preferenceFrameLayoutStyle">@style/Widget.Material.PreferenceFrameLayout</item> |
