diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 5bc0647159a3..27fac432a602 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -76,7 +76,6 @@ import android.os.RemoteException; import android.os.ServiceManager.ServiceNotFoundException; import android.os.StrictMode; -import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.text.Selection; @@ -7856,13 +7855,10 @@ final void performStart(String reason) { mFragments.dispatchStart(); mFragments.reportLoaderStart(); + // Warn app developers if the dynamic linker logged anything during startup. boolean isAppDebuggable = (mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; - - // This property is set for all non-user builds except final release - boolean isDlwarningEnabled = SystemProperties.getInt("ro.bionic.ld.warning", 0) == 1; - - if (isAppDebuggable || isDlwarningEnabled) { + if (isAppDebuggable) { String dlwarning = getDlWarning(); if (dlwarning != null) { String appName = getApplicationInfo().loadLabel(getPackageManager()) diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index 77a777024a21..a37fc80d6eeb 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -294,6 +294,13 @@ public class DownloadManager { */ public final static int PAUSED_UNKNOWN = 4; + /** + * Value of {@link #COLUMN_REASON} when the download is paused manually. + * + * @hide + */ + public final static int PAUSED_MANUAL = 5; + /** * Broadcast intent action sent by the download manager when a download completes. */ @@ -987,6 +994,7 @@ Cursor runQuery(ContentResolver resolver, String[] projection, Uri baseUri) { parts.add(statusClause("=", Downloads.Impl.STATUS_WAITING_TO_RETRY)); parts.add(statusClause("=", Downloads.Impl.STATUS_WAITING_FOR_NETWORK)); parts.add(statusClause("=", Downloads.Impl.STATUS_QUEUED_FOR_WIFI)); + parts.add(statusClause("=", Downloads.Impl.STATUS_PAUSED_MANUAL)); } if ((mStatusFlags & STATUS_SUCCESSFUL) != 0) { parts.add(statusClause("=", Downloads.Impl.STATUS_SUCCESS)); @@ -1245,6 +1253,34 @@ public void forceDownload(long... ids) { mResolver.update(mBaseUri, values, getWhereClauseForIds(ids), getWhereArgsForIds(ids)); } + /** + * Pause the given running download manually. + * + * @param id the ID of the download to be paused + * @return the number of downloads actually updated + * @hide + */ + public int pauseDownload(long id) { + ContentValues values = new ContentValues(); + values.put(Downloads.Impl.COLUMN_STATUS, Downloads.Impl.STATUS_PAUSED_MANUAL); + + return mResolver.update(ContentUris.withAppendedId(mBaseUri, id), values, null, null); + } + + /** + * Resume the given paused download manually. + * + * @param id the ID of the download to be resumed + * @return the number of downloads actually updated + * @hide + */ + public int resumeDownload(long id) { + ContentValues values = new ContentValues(); + values.put(Downloads.Impl.COLUMN_STATUS, Downloads.Impl.STATUS_RUNNING); + + return mResolver.update(ContentUris.withAppendedId(mBaseUri, id), values, null, null); + } + /** * Returns maximum size, in bytes, of downloads that may go over a mobile connection; or null if * there's no limit @@ -1682,6 +1718,9 @@ private long getPausedReason(int status) { case Downloads.Impl.STATUS_QUEUED_FOR_WIFI: return PAUSED_QUEUED_FOR_WIFI; + case Downloads.Impl.STATUS_PAUSED_MANUAL: + return PAUSED_MANUAL; + default: return PAUSED_UNKNOWN; } @@ -1737,6 +1776,7 @@ private int translateStatus(int status) { case Downloads.Impl.STATUS_WAITING_TO_RETRY: case Downloads.Impl.STATUS_WAITING_FOR_NETWORK: case Downloads.Impl.STATUS_QUEUED_FOR_WIFI: + case Downloads.Impl.STATUS_PAUSED_MANUAL: return STATUS_PAUSED; case Downloads.Impl.STATUS_SUCCESS: diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index 48ca71690a1b..1b232a4236ad 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -592,4 +592,14 @@ interface IActivityManager { * unlockProgressListener can be null if monitoring progress is not necessary. */ boolean startUserInForegroundWithListener(int userid, IProgressListener unlockProgressListener); + + /** + * Force full screen for devices with cutout + */ + boolean shouldForceCutoutFullscreen(in String packageName); + + /** + * Should disable touch if three fingers to screen shot is active? + */ + boolean isSwipeToScreenshotGestureActive(); } diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 32668980d131..c20bd88cab22 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -204,4 +204,7 @@ interface INotificationManager boolean getPrivateNotificationsAllowed(); long pullStats(long startNs, int report, boolean doAgg, out List stats); + + void forceShowLedLight(int color); + void forcePulseLedLight(int color, int onTime, int offTime); } diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index 69ec831b5d1d..8435f1c7aff4 100644 --- a/core/java/android/app/NotificationChannel.java +++ b/core/java/android/app/NotificationChannel.java @@ -74,6 +74,8 @@ public final class NotificationChannel implements Parcelable { private static final String ATT_IMPORTANCE = "importance"; private static final String ATT_LIGHTS = "lights"; private static final String ATT_LIGHT_COLOR = "light_color"; + private static final String ATT_ON_TIME = "light_on_time"; + private static final String ATT_OFF_TIME = "light_off_time"; private static final String ATT_VIBRATION = "vibration"; private static final String ATT_VIBRATION_ENABLED = "vibration_enabled"; private static final String ATT_SOUND = "sound"; @@ -137,7 +139,9 @@ public final class NotificationChannel implements Parcelable { USER_LOCKED_ALLOW_BUBBLE }; - private static final int DEFAULT_LIGHT_COLOR = 0; + private static final int DEFAULT_LIGHT_COLOR = 0xFFFFFFFF; + private static final int DEFAULT_ON_TIME = 0; + private static final int DEFAULT_OFF_TIME = 0; private static final int DEFAULT_VISIBILITY = NotificationManager.VISIBILITY_NO_OVERRIDE; private static final int DEFAULT_IMPORTANCE = @@ -156,6 +160,8 @@ public final class NotificationChannel implements Parcelable { private Uri mSound = Settings.System.DEFAULT_NOTIFICATION_URI; private boolean mLights; private int mLightColor = DEFAULT_LIGHT_COLOR; + private int mLightOnTime = DEFAULT_ON_TIME; + private int mLightOffTime = DEFAULT_OFF_TIME; private long[] mVibration; // Bitwise representation of fields that have been changed by the user, preventing the app from // making changes to these fields. @@ -231,6 +237,8 @@ protected NotificationChannel(Parcel in) { } mAudioAttributes = in.readInt() > 0 ? AudioAttributes.CREATOR.createFromParcel(in) : null; mLightColor = in.readInt(); + mLightOnTime = in.readInt(); + mLightOffTime = in.readInt(); mBlockableSystem = in.readBoolean(); mAllowBubbles = in.readBoolean(); mImportanceLockedByOEM = in.readBoolean(); @@ -285,6 +293,8 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeInt(0); } dest.writeInt(mLightColor); + dest.writeInt(mLightOnTime); + dest.writeInt(mLightOffTime); dest.writeBoolean(mBlockableSystem); dest.writeBoolean(mAllowBubbles); dest.writeBoolean(mImportanceLockedByOEM); @@ -420,6 +430,28 @@ public void setLightColor(int argb) { this.mLightColor = argb; } + /** + * Sets the notification light ON time for notifications posted to this channel, if lights are + * {@link #enableLights(boolean) enabled} on this channel and the device supports that feature. + * + * Only modifiable before the channel is submitted to + * {@link NotificationManager#notify(String, int, Notification)}. + */ + public void setLightOnTime(int time) { + this.mLightOnTime = time; + } + + /** + * Sets the notification light OFF time for notifications posted to this channel, if lights are + * {@link #enableLights(boolean) enabled} on this channel and the device supports that feature. + * + * Only modifiable before the channel is submitted to + * {@link NotificationManager#notify(String, int, Notification)}. + */ + public void setLightOffTime(int time) { + this.mLightOffTime = time; + } + /** * Sets whether notification posted to this channel should vibrate. The vibration pattern can * be set with {@link #setVibrationPattern(long[])}. @@ -565,6 +597,22 @@ public int getLightColor() { return mLightColor; } + /** + * Returns the notification light ON time for notifications posted to this channel. Irrelevant + * unless {@link #shouldShowLights()}. + */ + public int getLightOnTime() { + return mLightOnTime; + } + + /** + * Returns the notification light OFF time for notifications posted to this channel. Irrelevant + * unless {@link #shouldShowLights()}. + */ + public int getLightOffTime() { + return mLightOffTime; + } + /** * Returns whether notifications posted to this channel always vibrate. */ @@ -720,6 +768,8 @@ private void populateFromXml(XmlPullParser parser, boolean forRestore, enableLights(safeBool(parser, ATT_LIGHTS, false)); setLightColor(safeInt(parser, ATT_LIGHT_COLOR, DEFAULT_LIGHT_COLOR)); + setLightOnTime(safeInt(parser, ATT_ON_TIME, DEFAULT_ON_TIME)); + setLightOffTime(safeInt(parser, ATT_OFF_TIME, DEFAULT_OFF_TIME)); setVibrationPattern(safeLongArray(parser, ATT_VIBRATION, null)); enableVibration(safeBool(parser, ATT_VIBRATION_ENABLED, false)); setShowBadge(safeBool(parser, ATT_SHOW_BADGE, false)); @@ -823,6 +873,12 @@ private void writeXml(XmlSerializer out, boolean forBackup, @Nullable Context co if (getLightColor() != DEFAULT_LIGHT_COLOR) { out.attribute(null, ATT_LIGHT_COLOR, Integer.toString(getLightColor())); } + if (getLightOnTime() != DEFAULT_ON_TIME) { + out.attribute(null, ATT_ON_TIME, Integer.toString(getLightOnTime())); + } + if (getLightOffTime() != DEFAULT_OFF_TIME) { + out.attribute(null, ATT_OFF_TIME, Integer.toString(getLightOffTime())); + } if (shouldVibrate()) { out.attribute(null, ATT_VIBRATION_ENABLED, Boolean.toString(shouldVibrate())); } @@ -887,6 +943,8 @@ public JSONObject toJson() throws JSONException { } record.put(ATT_LIGHTS, Boolean.toString(shouldShowLights())); record.put(ATT_LIGHT_COLOR, Integer.toString(getLightColor())); + record.put(ATT_ON_TIME, Integer.toString(getLightOnTime())); + record.put(ATT_OFF_TIME, Integer.toString(getLightOffTime())); record.put(ATT_VIBRATION_ENABLED, Boolean.toString(shouldVibrate())); record.put(ATT_USER_LOCKED, Integer.toString(getUserLockedFields())); record.put(ATT_FG_SERVICE_SHOWN, Boolean.toString(isFgServiceShown())); @@ -990,6 +1048,8 @@ public boolean equals(Object o) { && getLockscreenVisibility() == that.getLockscreenVisibility() && mLights == that.mLights && getLightColor() == that.getLightColor() + && getLightOnTime() == that.getLightOnTime() + && getLightOffTime() == that.getLightOffTime() && getUserLockedFields() == that.getUserLockedFields() && isFgServiceShown() == that.isFgServiceShown() && mVibrationEnabled == that.mVibrationEnabled @@ -1011,11 +1071,15 @@ && isBlockableSystem() == that.isBlockableSystem() @Override public int hashCode() { int result = Objects.hash(getId(), getName(), mDesc, getImportance(), mBypassDnd, - getLockscreenVisibility(), getSound(), mLights, getLightColor(), + getLockscreenVisibility(), getSound(), mLights, getUserLockedFields(), isFgServiceShown(), mVibrationEnabled, mShowBadge, isDeleted(), getGroup(), getAudioAttributes(), isBlockableSystem(), mAllowBubbles, mImportanceLockedByOEM, mImportanceLockedDefaultApp); + + result = 31 * result + getLightColor(); + result = 31 * result + getLightOnTime(); + result = 31 * result + getLightOffTime(); result = 31 * result + Arrays.hashCode(mVibration); return result; } @@ -1033,6 +1097,8 @@ public void dump(PrintWriter pw, String prefix, boolean redacted) { + ", mSound=" + mSound + ", mLights=" + mLights + ", mLightColor=" + mLightColor + + ", mLightOnTime=" + mLightOnTime + + ", mLightOffTime=" + mLightOffTime + ", mVibration=" + Arrays.toString(mVibration) + ", mUserLockedFields=" + Integer.toHexString(mUserLockedFields) + ", mFgServiceShown=" + mFgServiceShown @@ -1061,6 +1127,8 @@ public String toString() { + ", mSound=" + mSound + ", mLights=" + mLights + ", mLightColor=" + mLightColor + + ", mLightOnTime=" + mLightOnTime + + ", mLightOffTime=" + mLightOffTime + ", mVibration=" + Arrays.toString(mVibration) + ", mUserLockedFields=" + Integer.toHexString(mUserLockedFields) + ", mFgServiceShown=" + mFgServiceShown diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index c6aa4fd86594..1052564ef119 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -2084,4 +2084,24 @@ public static int zenModeFromInterruptionFilter(int interruptionFilter, int defV default: return defValue; } } + + /** @hide */ + public void forceShowLedLight(int color) { + final INotificationManager service = getService(); + try { + service.forceShowLedLight(color); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** @hide */ + public void forcePulseLedLight(int color, int onTime, int offTime) { + final INotificationManager service = getService(); + try { + service.forcePulseLedLight(color, onTime, offTime); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } } diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 136e932a3eb0..d1090a348e72 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -944,17 +944,11 @@ public IrisManager createService(ContextImpl ctx) @Override public BiometricManager createService(ContextImpl ctx) throws ServiceNotFoundException { - if (BiometricManager.hasBiometrics(ctx)) { - final IBinder binder = - ServiceManager.getServiceOrThrow(Context.BIOMETRIC_SERVICE); - final IBiometricService service = - IBiometricService.Stub.asInterface(binder); - return new BiometricManager(ctx.getOuterContext(), service); - } else { - // Allow access to the manager when service is null. This saves memory - // on devices without biometric hardware. - return new BiometricManager(ctx.getOuterContext(), null); - } + final IBinder binder = + ServiceManager.getServiceOrThrow(Context.BIOMETRIC_SERVICE); + final IBiometricService service = + IBiometricService.Stub.asInterface(binder); + return new BiometricManager(ctx.getOuterContext(), service); } }); diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 388161d76308..d15dd102099c 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -1014,7 +1014,11 @@ public String getName() { try { String name = service.getRemoteName(this); if (name != null) { - return name.replaceAll("[\\t\\n\\r]+", " "); + // remove whitespace characters from the name + return name + .replace('\t', ' ') + .replace('\n', ' ') + .replace('\r', ' '); } return null; } catch (RemoteException e) { diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 535a8bc9db75..bce50186b60b 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -3668,7 +3668,7 @@ private boolean parseBaseApplication(Package owner, Resources res, if (sa.getBoolean( R.styleable.AndroidManifestApplication_allowAudioPlaybackCapture, - owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q)) { + owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)) { ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_ALLOW_AUDIO_PLAYBACK_CAPTURE; } diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index 33e51c9fa11c..0869ec9cb241 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -39,6 +39,7 @@ import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemProperties; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RSIllegalArgumentException; @@ -56,6 +57,7 @@ import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -165,6 +167,10 @@ public class Camera { private static final int CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x200; private static final int CAMERA_MSG_PREVIEW_METADATA = 0x400; private static final int CAMERA_MSG_FOCUS_MOVE = 0x800; + /* ### QC ADD-ONS: START */ + private static final int CAMERA_MSG_STATS_DATA = 0x1000; + private static final int CAMERA_MSG_META_DATA = 0x2000; + /* ### QC ADD-ONS: END */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) private long mNativeContext; // accessed by native methods @@ -196,6 +202,17 @@ public class Camera { private boolean mShutterSoundEnabledFromApp = true; private static final int NO_ERROR = 0; + private static final int EACCESS = -13; + private static final int ENODEV = -19; + private static final int EBUSY = -16; + private static final int EINVAL = -22; + private static final int ENOSYS = -38; + private static final int EUSERS = -87; + private static final int EOPNOTSUPP = -95; + /* ### QC ADD-ONS: START */ + private CameraDataCallback mCameraDataCallback; + private CameraMetaDataCallback mCameraMetaDataCallback; + /* ### QC ADD-ONS: END */ /** * Broadcast Action: A new picture is taken by the camera, and the entry of @@ -277,7 +294,37 @@ public class Camera { * @return total number of accessible camera devices, or 0 if there are no * cameras or an error was encountered enumerating them. */ - public native static int getNumberOfCameras(); + public static int getNumberOfCameras() { + boolean exposeAuxCamera = true; + String packageName = ActivityThread.currentOpPackageName(); + /* Force to expose only two cameras + * if the package name does not falls in this bucket + */ + String packageList = SystemProperties.get("vendor.camera.aux.packagelist", ""); + String packageBlacklist = SystemProperties.get("vendor.camera.aux.packageblacklist", ""); + if (!packageList.isEmpty()) { + exposeAuxCamera = false; + if (Arrays.asList(packageList.split(",")).contains(packageName)) { + exposeAuxCamera = true; + } + } else if (!packageBlacklist.isEmpty()) { + exposeAuxCamera = true; + if (Arrays.asList(packageBlacklist.split(",")).contains(packageName)) { + exposeAuxCamera = false; + } + } + int numberOfCameras = _getNumberOfCameras(); + if (exposeAuxCamera == false && (numberOfCameras > 2)) { + numberOfCameras = 2; + } + return numberOfCameras; + } + + /** + * Returns the number of physical cameras available on this device. + */ + /** @hide */ + public native static int _getNumberOfCameras(); /** * Returns the information about a particular camera. @@ -288,6 +335,9 @@ public class Camera { * low-level failure). */ public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) { + if(cameraId >= getNumberOfCameras()){ + throw new RuntimeException("Unknown camera ID"); + } _getCameraInfo(cameraId, cameraInfo); IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE); IAudioService audioService = IAudioService.Stub.asInterface(b); @@ -321,6 +371,17 @@ public static class CameraInfo { */ public static final int CAMERA_FACING_FRONT = 1; + /* ### QC ADD-ONS: START TBD*/ + /** @hide + * camera is in ZSL mode. + */ + public static final int CAMERA_SUPPORT_MODE_ZSL = 2; + + /** @hide + * camera is in non-ZSL mode. + */ + public static final int CAMERA_SUPPORT_MODE_NONZSL = 3; + /* ### QC ADD-ONS: END */ /** * The direction that the camera faces. It should be * CAMERA_FACING_BACK or CAMERA_FACING_FRONT. @@ -507,6 +568,10 @@ private int cameraInitVersion(int cameraId, int halVersion) { mPostviewCallback = null; mUsingPreviewAllocation = false; mZoomListener = null; + /* ### QC ADD-ONS: START */ + mCameraDataCallback = null; + mCameraMetaDataCallback = null; + /* ### QC ADD-ONS: END */ Looper looper; if ((looper = Looper.myLooper()) != null) { @@ -517,8 +582,17 @@ private int cameraInitVersion(int cameraId, int halVersion) { mEventHandler = null; } - return native_setup(new WeakReference(this), cameraId, halVersion, - ActivityThread.currentOpPackageName()); + String packageName = ActivityThread.currentOpPackageName(); + + // Force HAL1 if the package name is in our 'blacklist' + String packageList = SystemProperties.get("vendor.camera.hal1.packagelist", ""); + if (!packageList.isEmpty()) { + if (Arrays.asList(packageList.split(",")).contains(packageName)) { + halVersion = CAMERA_HAL_API_VERSION_1_0; + } + } + + return native_setup(new WeakReference(this), cameraId, halVersion, packageName); } private int cameraInitNormal(int cameraId) { @@ -545,6 +619,9 @@ public int cameraInitUnspecified(int cameraId) { /** used by Camera#open, Camera#open(int) */ Camera(int cameraId) { + if(cameraId >= getNumberOfCameras()){ + throw new RuntimeException("Unknown camera ID"); + } int err = cameraInitNormal(cameraId); if (checkInitErrors(err)) { if (err == -EACCES) { @@ -1269,7 +1346,23 @@ public void handleMessage(Message msg) { mAutoFocusMoveCallback.onAutoFocusMoving(msg.arg1 == 0 ? false : true, mCamera); } return; + /* ### QC ADD-ONS: START */ + case CAMERA_MSG_STATS_DATA: + int statsdata[] = new int[257]; + for(int i =0; i<257; i++ ) { + statsdata[i] = byteToInt( (byte[])msg.obj, i*4); + } + if (mCameraDataCallback != null) { + mCameraDataCallback.onCameraData(statsdata, mCamera); + } + return; + case CAMERA_MSG_META_DATA: + if (mCameraMetaDataCallback != null) { + mCameraMetaDataCallback.onCameraMetaData((byte[])msg.obj, mCamera); + } + return; + /* ### QC ADD-ONS: END */ default: Log.e(TAG, "Unknown message type " + msg.what); return; @@ -2134,6 +2227,27 @@ public Parameters getParameters() { return p; } + /** @hide + * Returns the current cct value of white balance. + * + * If it's in AWB mode, cct is determined by stats/awb module. + * + * If it's in Manual WB mode, it actually returns cct value + * set by user via {@link #setParameters(Camera.Parameters)}. + */ + public int getWBCurrentCCT() { + Parameters p = new Parameters(); + String s = native_getParameters(); + p.unflatten(s); + + int cct = 0; + if (p.getWBCurrentCCT() != null) { + cct = Integer.parseInt(p.getWBCurrentCCT()); + } + + return cct; + } + /** * Returns an empty {@link Parameters} for testing purpose. * @@ -2147,6 +2261,157 @@ public static Parameters getEmptyParameters() { return camera.new Parameters(); } + /* ### QC ADD-ONS: START */ + private static int byteToInt(byte[] b, int offset) { + int value = 0; + for (int i = 0; i < 4; i++) { + int shift = (4 - 1 - i) * 8; + value += (b[(3-i) + offset] & 0x000000FF) << shift; + } + return value; + } + /** @hide + * Handles the callback for when Camera Data is available. + * data is read from the camera. + */ + public interface CameraDataCallback { + /** + * Callback for when camera data is available. + * + * @param data a int array of the camera data + * @param camera the Camera service object + */ + void onCameraData(int[] data, Camera camera); + }; + + /** @hide + * Set camera histogram mode and registers a callback function to run. + * Only valid after startPreview() has been called. + * + * @param cb the callback to run + */ + public final void setHistogramMode(CameraDataCallback cb) + { + mCameraDataCallback = cb; + native_setHistogramMode(cb!=null); + } + private native final void native_setHistogramMode(boolean mode); + + /** @hide + * Set camera histogram command to send data. + * + */ + public final void sendHistogramData() + { + native_sendHistogramData(); + } + private native final void native_sendHistogramData(); + + /** @hide + * Handles the callback for when Camera Meta Data is available. + * Meta data is read from the camera. + */ + public interface CameraMetaDataCallback { + /** + * Callback for when camera meta data is available. + * + * @param data a byte array of the camera meta data + * @param camera the Camera service object + */ + void onCameraMetaData(byte[] data, Camera camera); + }; + + /** @hide + * Set camera meta data and registers a callback function to run. + * Only valid after startPreview() has been called. + * + * @param cb the callback to run + */ + public final void setMetadataCb(CameraMetaDataCallback cb) + { + mCameraMetaDataCallback = cb; + native_setMetadataCb(cb!=null); + } + private native final void native_setMetadataCb(boolean mode); + + /** @hide + * Set camera face detection command to send meta data. + */ + public final void sendMetaData() + { + native_sendMetaData(); + } + private native final void native_sendMetaData(); + + /** @hide + * Configure longshot mode. Available only in ZSL. + * + * @param enable enable/disable this mode + */ + public final void setLongshot(boolean enable) + { + native_setLongshot(enable); + } + private native final void native_setLongshot(boolean enable); + + /** @hide + * Handles the Touch Co-ordinate. + */ + public class Coordinate { + /** + * Sets the x,y co-ordinates for a touch event + * + * @param x the x co-ordinate (pixels) + * @param y the y co-ordinate (pixels) + */ + public Coordinate(int x, int y) { + xCoordinate = x; + yCoordinate = y; + } + /** + * Compares {@code obj} to this co-ordinate. + * + * @param obj the object to compare this co-ordinate with. + * @return {@code true} if the xCoordinate and yCoordinate of {@code obj} is the + * same as those of this coordinate. {@code false} otherwise. + */ + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Coordinate)) { + return false; + } + Coordinate c = (Coordinate) obj; + return xCoordinate == c.xCoordinate && yCoordinate == c.yCoordinate; + } + + /** x co-ordinate for the touch event*/ + public int xCoordinate; + + /** y co-ordinate for the touch event */ + public int yCoordinate; + }; + + /** @hide + * Returns the current focus position. + * + * If it's in AF mode, it's the lens position after af is done. + * + * If it's in Manual Focus mode, it actually returns the value + * set by user via {@link #setParameters(Camera.Parameters)}. + */ + public int getCurrentFocusPosition() { + Parameters p = new Parameters(); + String s = native_getParameters(); + p.unflatten(s); + + int focus_pos = -1; + if (p.getCurrentFocusPosition() != null) { + focus_pos = Integer.parseInt(p.getCurrentFocusPosition()); + } + return focus_pos; + } + + /* ### QC ADD-ONS: END */ /** * Returns a copied {@link Parameters}; for shim use only. * @@ -2394,6 +2659,10 @@ public class Parameters { public static final String WHITE_BALANCE_CLOUDY_DAYLIGHT = "cloudy-daylight"; public static final String WHITE_BALANCE_TWILIGHT = "twilight"; public static final String WHITE_BALANCE_SHADE = "shade"; + /** @hide + * wb manual cct mode. + */ + public static final String WHITE_BALANCE_MANUAL_CCT = "manual-cct"; // Values for color effect settings. public static final String EFFECT_NONE = "none"; @@ -2441,6 +2710,11 @@ public class Parameters { */ public static final String FLASH_MODE_TORCH = "torch"; + /** @hide + * Scene mode is off. + */ + public static final String SCENE_MODE_ASD = "asd"; + /** * Scene mode is off. */ @@ -2517,6 +2791,14 @@ public class Parameters { * Capture the naturally warm color of scenes lit by candles. */ public static final String SCENE_MODE_CANDLELIGHT = "candlelight"; + /** @hide + * SCENE_MODE_BACKLIGHT + **/ + public static final String SCENE_MODE_BACKLIGHT = "backlight"; + /** @hide + * SCENE_MODE_FLOWERS + **/ + public static final String SCENE_MODE_FLOWERS = "flowers"; /** * Applications are looking for a barcode. Camera driver will be @@ -2559,6 +2841,13 @@ public class Parameters { */ public static final String FOCUS_MODE_FIXED = "fixed"; + /** @hide + * Normal focus mode. Applications should call + * {@link #autoFocus(AutoFocusCallback)} to start the focus in this + * mode. + */ + public static final String FOCUS_MODE_NORMAL = "normal"; + /** * Extended depth of field (EDOF). Focusing is done digitally and * continuously. Applications should not call {@link @@ -2611,6 +2900,11 @@ public class Parameters { */ public static final String FOCUS_MODE_CONTINUOUS_PICTURE = "continuous-picture"; + /** @hide + * manual focus mode + */ + public static final String FOCUS_MODE_MANUAL_POSITION = "manual"; + // Indices for focus distance array. /** * The array index of near focus distance for use with @@ -2647,11 +2941,15 @@ public class Parameters { // Formats for setPreviewFormat and setPictureFormat. private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp"; private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp"; + private static final String PIXEL_FORMAT_YUV420SP_ADRENO = "yuv420sp-adreno"; private static final String PIXEL_FORMAT_YUV422I = "yuv422i-yuyv"; private static final String PIXEL_FORMAT_YUV420P = "yuv420p"; private static final String PIXEL_FORMAT_RGB565 = "rgb565"; private static final String PIXEL_FORMAT_JPEG = "jpeg"; private static final String PIXEL_FORMAT_BAYER_RGGB = "bayer-rggb"; + private static final String PIXEL_FORMAT_RAW = "raw"; + private static final String PIXEL_FORMAT_YV12 = "yv12"; + private static final String PIXEL_FORMAT_NV12 = "nv12"; /** * Order matters: Keys that are {@link #set(String, String) set} later @@ -3471,8 +3769,11 @@ public void setGpsProcessingMethod(String processing_method) { * parameters. */ public void removeGpsData() { + remove(KEY_QC_GPS_LATITUDE_REF); remove(KEY_GPS_LATITUDE); + remove(KEY_QC_GPS_LONGITUDE_REF); remove(KEY_GPS_LONGITUDE); + remove(KEY_QC_GPS_ALTITUDE_REF); remove(KEY_GPS_ALTITUDE); remove(KEY_GPS_TIMESTAMP); remove(KEY_GPS_PROCESSING_METHOD); @@ -3642,6 +3943,7 @@ public String getSceneMode() { * @see #getSceneMode() */ public void setSceneMode(String value) { + if(getSupportedSceneModes() == null) return; set(KEY_SCENE_MODE, value); } @@ -3679,6 +3981,7 @@ public String getFlashMode() { * @see #getFlashMode() */ public void setFlashMode(String value) { + if(getSupportedFlashModes() == null) return; set(KEY_FLASH_MODE, value); } @@ -4496,5 +4799,1231 @@ private boolean same(String s1, String s2) { if (s1 != null && s1.equals(s2)) return true; return false; } + /* ### QC ADD-ONS: START */ + + /* ### QC ADDED PARAMETER KEYS*/ + private static final String KEY_QC_HFR_SIZE = "hfr-size"; + private static final String KEY_QC_PREVIEW_FRAME_RATE_MODE = "preview-frame-rate-mode"; + private static final String KEY_QC_PREVIEW_FRAME_RATE_AUTO_MODE = "frame-rate-auto"; + private static final String KEY_QC_PREVIEW_FRAME_RATE_FIXED_MODE = "frame-rate-fixed"; + private static final String KEY_QC_GPS_LATITUDE_REF = "gps-latitude-ref"; + private static final String KEY_QC_GPS_LONGITUDE_REF = "gps-longitude-ref"; + private static final String KEY_QC_GPS_ALTITUDE_REF = "gps-altitude-ref"; + private static final String KEY_QC_GPS_STATUS = "gps-status"; + private static final String KEY_QC_EXIF_DATETIME = "exif-datetime"; + private static final String KEY_QC_TOUCH_AF_AEC = "touch-af-aec"; + private static final String KEY_QC_TOUCH_INDEX_AEC = "touch-index-aec"; + private static final String KEY_QC_TOUCH_INDEX_AF = "touch-index-af"; + private static final String KEY_QC_MANUAL_FOCUS_POSITION = "manual-focus-position"; + private static final String KEY_QC_MANUAL_FOCUS_POS_TYPE = "manual-focus-pos-type"; + private static final String KEY_QC_SCENE_DETECT = "scene-detect"; + private static final String KEY_QC_ISO_MODE = "iso"; + private static final String KEY_QC_EXPOSURE_TIME = "exposure-time"; + private static final String KEY_QC_MIN_EXPOSURE_TIME = "min-exposure-time"; + private static final String KEY_QC_MAX_EXPOSURE_TIME = "max-exposure-time"; + private static final String KEY_QC_LENSSHADE = "lensshade"; + private static final String KEY_QC_HISTOGRAM = "histogram"; + private static final String KEY_QC_SKIN_TONE_ENHANCEMENT = "skinToneEnhancement"; + private static final String KEY_QC_AUTO_EXPOSURE = "auto-exposure"; + private static final String KEY_QC_SHARPNESS = "sharpness"; + private static final String KEY_QC_MAX_SHARPNESS = "max-sharpness"; + private static final String KEY_QC_CONTRAST = "contrast"; + private static final String KEY_QC_MAX_CONTRAST = "max-contrast"; + private static final String KEY_QC_SATURATION = "saturation"; + private static final String KEY_QC_MAX_SATURATION = "max-saturation"; + private static final String KEY_QC_DENOISE = "denoise"; + private static final String KEY_QC_CONTINUOUS_AF = "continuous-af"; + private static final String KEY_QC_SELECTABLE_ZONE_AF = "selectable-zone-af"; + private static final String KEY_QC_FACE_DETECTION = "face-detection"; + private static final String KEY_QC_MEMORY_COLOR_ENHANCEMENT = "mce"; + private static final String KEY_QC_REDEYE_REDUCTION = "redeye-reduction"; + private static final String KEY_QC_ZSL = "zsl"; + private static final String KEY_QC_CAMERA_MODE = "camera-mode"; + private static final String KEY_QC_VIDEO_HIGH_FRAME_RATE = "video-hfr"; + private static final String KEY_QC_VIDEO_HDR = "video-hdr"; + private static final String KEY_QC_POWER_MODE = "power-mode"; + private static final String KEY_QC_POWER_MODE_SUPPORTED = "power-mode-supported"; + private static final String KEY_QC_WB_MANUAL_CCT = "wb-manual-cct"; + private static final String KEY_QC_MIN_WB_CCT = "min-wb-cct"; + private static final String KEY_QC_MAX_WB_CCT = "max-wb-cct"; + private static final String KEY_QC_AUTO_HDR_ENABLE = "auto-hdr-enable"; + private static final String KEY_QC_VIDEO_ROTATION = "video-rotation"; + + /** @hide + * KEY_QC_AE_BRACKET_HDR + **/ + public static final String KEY_QC_AE_BRACKET_HDR = "ae-bracket-hdr"; + + /* ### QC ADDED PARAMETER VALUES*/ + + // Values for touch af/aec settings. + /** @hide + * TOUCH_AF_AEC_OFF + **/ + public static final String TOUCH_AF_AEC_OFF = "touch-off"; + /** @hide + * TOUCH_AF_AEC_ON + **/ + public static final String TOUCH_AF_AEC_ON = "touch-on"; + + // Values for auto exposure settings. + /** @hide + * Auto exposure frame-avg + **/ + public static final String AUTO_EXPOSURE_FRAME_AVG = "frame-average"; + /** @hide + * Auto exposure center weighted + **/ + public static final String AUTO_EXPOSURE_CENTER_WEIGHTED = "center-weighted"; + /** @hide + * Auto exposure spot metering + **/ + public static final String AUTO_EXPOSURE_SPOT_METERING = "spot-metering"; + + //Values for ISO settings + /** @hide + * ISO_AUTO + **/ + public static final String ISO_AUTO = "auto"; + /** @hide + * ISO_HJR + **/ + public static final String ISO_HJR = "ISO_HJR"; + /** @hide + * ISO_100 + **/ + public static final String ISO_100 = "ISO100"; + /** @hide + * ISO_200 + **/ + public static final String ISO_200 = "ISO200"; + /** @hide + * ISO_400 + **/ + public static final String ISO_400 = "ISO400"; + /** @hide + * ISO_800 + **/ + public static final String ISO_800 = "ISO800"; + /** @hide + * ISO_1600 + **/ + public static final String ISO_1600 = "ISO1600"; + + /** @hide + * ISO_3200 + **/ + public static final String ISO_3200 = "ISO3200"; + + //Values for Lens Shading + /** @hide + * LENSSHADE_ENABLE + **/ + public static final String LENSSHADE_ENABLE = "enable"; + /** @hide + * LENSSHADE_DISABLE + **/ + public static final String LENSSHADE_DISABLE= "disable"; + + //Values for Histogram + /** @hide + * Histogram enable + **/ + public static final String HISTOGRAM_ENABLE = "enable"; + /** @hide + * Histogram disable + **/ + public static final String HISTOGRAM_DISABLE= "disable"; + + //Values for Skin Tone Enhancement + /** @hide + * SKIN_TONE_ENHANCEMENT_ENABLE + **/ + public static final String SKIN_TONE_ENHANCEMENT_ENABLE = "enable"; + /** @hide + * SKIN_TONE_ENHANCEMENT_DISABLE + **/ + public static final String SKIN_TONE_ENHANCEMENT_DISABLE= "disable"; + + // Values for MCE settings. + /** @hide + * MCE_ENaBLE + **/ + public static final String MCE_ENABLE = "enable"; + /** @hide + * MCE_DISABLE + **/ + public static final String MCE_DISABLE = "disable"; + + // Values for ZSL settings. + /** @hide + * ZSL_ON + **/ + public static final String ZSL_ON = "on"; + /** @hide + * ZSL_OFF + **/ + public static final String ZSL_OFF = "off"; + + // Values for HDR Bracketing settings. + + /** @hide + * AEC bracketing off + **/ + public static final String AE_BRACKET_HDR_OFF = "Off"; + /** @hide + * AEC bracketing hdr + **/ + public static final String AE_BRACKET_HDR = "HDR"; + /** @hide + * AEC bracketing aec-bracket + **/ + public static final String AE_BRACKET = "AE-Bracket"; + + // Values for Power mode. + /** @hide + * LOW_POWER + **/ + public static final String LOW_POWER = "Low_Power"; + /** @hide + * NORMAL_POWER + **/ + public static final String NORMAL_POWER = "Normal_Power"; + + // Values for HFR settings. + /** @hide + * VIDEO_HFR_OFF + **/ + public static final String VIDEO_HFR_OFF = "off"; + /** @hide + * VIDEO_HFR_2X + **/ + public static final String VIDEO_HFR_2X = "60"; + /** @hide + * VIDEO_HFR_3X + **/ + public static final String VIDEO_HFR_3X = "90"; + /** @hide + * VIDEO_HFR_4X + **/ + public static final String VIDEO_HFR_4X = "120"; + + // Values for auto scene detection settings. + /** @hide + * SCENE_DETECT_OFF + **/ + public static final String SCENE_DETECT_OFF = "off"; + /** @hide + * SCENE_DETECT_ON + **/ + public static final String SCENE_DETECT_ON = "on"; + + //Values for Continuous AF + + /** @hide + * CAF off + **/ + public static final String CONTINUOUS_AF_OFF = "caf-off"; + /** @hide + * CAF on + **/ + public static final String CONTINUOUS_AF_ON = "caf-on"; + /** @hide + * Denoise off + **/ + public static final String DENOISE_OFF = "denoise-off"; + /** @hide + * Denoise on + **/ + public static final String DENOISE_ON = "denoise-on"; + + // Values for Redeye Reduction settings. + /** @hide + * REDEYE_REDUCTION_ENABLE + **/ + public static final String REDEYE_REDUCTION_ENABLE = "enable"; + /** @hide + * REDEYE_REDUCTION_DISABLE + **/ + public static final String REDEYE_REDUCTION_DISABLE = "disable"; + + // Values for selectable zone af settings. + /** @hide + * SELECTABLE_ZONE_AF_AUTO + **/ + public static final String SELECTABLE_ZONE_AF_AUTO = "auto"; + /** @hide + * SELECTABLE_ZONE_AF_SPOTMETERING + **/ + public static final String SELECTABLE_ZONE_AF_SPOTMETERING = "spot-metering"; + /** @hide + * SELECTABLE_ZONE_AF_CENTER_WEIGHTED + **/ + public static final String SELECTABLE_ZONE_AF_CENTER_WEIGHTED = "center-weighted"; + /** @hide + * SELECTABLE_ZONE_AF_FRAME_AVERAGE + **/ + public static final String SELECTABLE_ZONE_AF_FRAME_AVERAGE = "frame-average"; + + // Values for Face Detection settings. + /** @hide + * Face Detection off + **/ + public static final String FACE_DETECTION_OFF = "off"; + /** @hide + * Face Detction on + **/ + public static final String FACE_DETECTION_ON = "on"; + + // Values for video rotation settings. + + /** @hide + * VIDEO_ROTATION_0 + **/ + public static final String VIDEO_ROTATION_0 = "0"; + /** @hide + * VIDEO_ROTATION_90 + **/ + public static final String VIDEO_ROTATION_90 = "90"; + /** @hide + * VIDEO_ROTATION_180 + **/ + public static final String VIDEO_ROTATION_180 = "180"; + /** @hide + * VIDEO_ROTATION_270 + **/ + public static final String VIDEO_ROTATION_270 = "270"; + + /* ### QC ADDED PARAMETER APIS*/ + /** @hide + * Gets the supported preview sizes in high frame rate recording mode. + * + * @return a list of Size object. This method will always return a list + * with at least one element. + */ + public List getSupportedHfrSizes() { + String str = get(KEY_QC_HFR_SIZE + SUPPORTED_VALUES_SUFFIX); + return splitSize(str); + } + + /** @hide + * Gets the supported Touch AF/AEC setting. + * + * @return a List of TOUCH_AF_AEC_XXX string constants. null if TOUCH AF/AEC + * setting is not supported. + * + */ + public List getSupportedTouchAfAec() { + String str = get(KEY_QC_TOUCH_AF_AEC + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** + * Gets the supported Touch AF/AEC setting. + * + * @return a List of TOUCH_AF_AEC_XXX string constants. null if TOUCH AF/AEC + * setting is not supported. + * + */ + + /** @hide + * Gets the supported frame rate modes. + * + * @return a List of FRAME_RATE_XXX_MODE string constant. null if this + * setting is not supported. + */ + public List getSupportedPreviewFrameRateModes() { + String str = get(KEY_QC_PREVIEW_FRAME_RATE_MODE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported auto scene detection modes. + * + * @return a List of SCENE_DETECT_XXX string constant. null if scene detection + * setting is not supported. + * + */ + public List getSupportedSceneDetectModes() { + String str = get(KEY_QC_SCENE_DETECT + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported ISO values. + * + * @return a List of FLASH_MODE_XXX string constants. null if flash mode + * setting is not supported. + */ + public List getSupportedIsoValues() { + String str = get(KEY_QC_ISO_MODE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported Lensshade modes. + * + * @return a List of LENS_MODE_XXX string constants. null if lens mode + * setting is not supported. + */ + public List getSupportedLensShadeModes() { + String str = get(KEY_QC_LENSSHADE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported Histogram modes. + * + * @return a List of HISTOGRAM_XXX string constants. null if histogram mode + * setting is not supported. + */ + public List getSupportedHistogramModes() { + String str = get(KEY_QC_HISTOGRAM + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported Skin Tone Enhancement modes. + * + * @return a List of SKIN_TONE_ENHANCEMENT_XXX string constants. null if skin tone enhancement + * setting is not supported. + */ + public List getSupportedSkinToneEnhancementModes() { + String str = get(KEY_QC_SKIN_TONE_ENHANCEMENT + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported auto exposure setting. + * + * @return a List of AUTO_EXPOSURE_XXX string constants. null if auto exposure + * setting is not supported. + */ + public List getSupportedAutoexposure() { + String str = get(KEY_QC_AUTO_EXPOSURE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported MCE modes. + * + * @return a List of MCE_ENABLE/DISABLE string constants. null if MCE mode + * setting is not supported. + */ + public List getSupportedMemColorEnhanceModes() { + String str = get(KEY_QC_MEMORY_COLOR_ENHANCEMENT + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported ZSL modes. + * + * @return a List of ZSL_OFF/OFF string constants. null if ZSL mode + * setting is not supported. + */ + public List getSupportedZSLModes() { + String str = get(KEY_QC_ZSL + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported Video HDR modes. + * + * @return a List of Video HDR_OFF/OFF string constants. null if + * Video HDR mode setting is not supported. + */ + public List getSupportedVideoHDRModes() { + String str = get(KEY_QC_VIDEO_HDR + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported HFR modes. + * + * @return a List of VIDEO_HFR_XXX string constants. null if hfr mode + * setting is not supported. + */ + public List getSupportedVideoHighFrameRateModes() { + String str = get(KEY_QC_VIDEO_HIGH_FRAME_RATE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported Continuous AF modes. + * + * @return a List of CONTINUOUS_AF_XXX string constant. null if continuous AF + * setting is not supported. + * + */ + public List getSupportedContinuousAfModes() { + String str = get(KEY_QC_CONTINUOUS_AF + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported DENOISE modes. + * + * @return a List of DENOISE_XXX string constant. null if DENOISE + * setting is not supported. + * + */ + public List getSupportedDenoiseModes() { + String str = get(KEY_QC_DENOISE + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported selectable zone af setting. + * + * @return a List of SELECTABLE_ZONE_AF_XXX string constants. null if selectable zone af + * setting is not supported. + */ + public List getSupportedSelectableZoneAf() { + String str = get(KEY_QC_SELECTABLE_ZONE_AF + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported face detection modes. + * + * @return a List of FACE_DETECTION_XXX string constant. null if face detection + * setting is not supported. + * + */ + public List getSupportedFaceDetectionModes() { + String str = get(KEY_QC_FACE_DETECTION + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Gets the supported redeye reduction modes. + * + * @return a List of REDEYE_REDUCTION_XXX string constant. null if redeye reduction + * setting is not supported. + * + */ + public List getSupportedRedeyeReductionModes() { + String str = get(KEY_QC_REDEYE_REDUCTION + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + /** @hide + * Sets GPS altitude reference. This will be stored in JPEG EXIF header. + * @param altRef reference GPS altitude in meters. + */ + public void setGpsAltitudeRef(double altRef) { + set(KEY_QC_GPS_ALTITUDE_REF, Double.toString(altRef)); + } + + /** @hide + * Sets GPS Status. This will be stored in JPEG EXIF header. + * + * @param status GPS status (UTC in seconds since January 1, + * 1970). + */ + public void setGpsStatus(double status) { + set(KEY_QC_GPS_STATUS, Double.toString(status)); + } + + /** @hide + * Sets the touch co-ordinate for Touch AEC. + * + * @param x the x co-ordinate of the touch event + * @param y the y co-ordinate of the touch event + * + */ + public void setTouchIndexAec(int x, int y) { + String v = Integer.toString(x) + "x" + Integer.toString(y); + set(KEY_QC_TOUCH_INDEX_AEC, v); + } + + /** @hide + * Returns the touch co-ordinates of the touch event. + * + * @return a Index object with the x and y co-ordinated + * for the touch event + * + */ + public Coordinate getTouchIndexAec() { + String pair = get(KEY_QC_TOUCH_INDEX_AEC); + return strToCoordinate(pair); + } + + /** @hide + * Sets the touch co-ordinate for Touch AF. + * + * @param x the x co-ordinate of the touch event + * @param y the y co-ordinate of the touch event + * + */ + public void setTouchIndexAf(int x, int y) { + String v = Integer.toString(x) + "x" + Integer.toString(y); + set(KEY_QC_TOUCH_INDEX_AF, v); + } + + /** @hide + * Returns the touch co-ordinates of the touch event. + * + * @return a Index object with the x and y co-ordinated + * for the touch event + * + */ + public Coordinate getTouchIndexAf() { + String pair = get(KEY_QC_TOUCH_INDEX_AF); + return strToCoordinate(pair); + } + /** @hide + * Set Sharpness Level + * + * @param sharpness level + */ + public void setSharpness(int sharpness){ + if((sharpness < 0) || (sharpness > getMaxSharpness()) ) + throw new IllegalArgumentException( + "Invalid Sharpness " + sharpness); + + set(KEY_QC_SHARPNESS, String.valueOf(sharpness)); + } + + /** @hide + * Set Contrast Level + * + * @param contrast level + */ + public void setContrast(int contrast){ + if((contrast < 0 ) || (contrast > getMaxContrast())) + throw new IllegalArgumentException( + "Invalid Contrast " + contrast); + + set(KEY_QC_CONTRAST, String.valueOf(contrast)); + } + + /** @hide + * Set Saturation Level + * + * @param saturation level + */ + public void setSaturation(int saturation){ + if((saturation < 0 ) || (saturation > getMaxSaturation())) + throw new IllegalArgumentException( + "Invalid Saturation " + saturation); + + set(KEY_QC_SATURATION, String.valueOf(saturation)); + } + + /** @hide + * @return true if full size video snapshot is supported. + */ + public boolean isPowerModeSupported() { + String str = get(KEY_QC_POWER_MODE_SUPPORTED); + return TRUE.equals(str); + } + + /** @hide + * Get Sharpness level + * + * @return sharpness level + */ + public int getSharpness(){ + return getInt(KEY_QC_SHARPNESS); + } + + /** @hide + * Get Max Sharpness Level + * + * @return max sharpness level + */ + public int getMaxSharpness(){ + return getInt(KEY_QC_MAX_SHARPNESS); + } + + /** @hide + * Get Contrast level + * + * @return contrast level + */ + public int getContrast(){ + return getInt(KEY_QC_CONTRAST); + } + + /** @hide + * Get Max Contrast Level + * + * @return max contrast level + */ + public int getMaxContrast(){ + return getInt(KEY_QC_MAX_CONTRAST); + } + + /** @hide + * Get Saturation level + * + * @return saturation level + */ + public int getSaturation(){ + return getInt(KEY_QC_SATURATION); + } + + /** @hide + * Get Max Saturation Level + * + * @return max contrast level + */ + public int getMaxSaturation(){ + return getInt(KEY_QC_MAX_SATURATION); + } + + /** @hide + * Sets GPS latitude reference coordinate. This will be stored in JPEG EXIF + * header. + * @param latRef GPS latitude reference coordinate. + */ + public void setGpsLatitudeRef(String latRef) { + set(KEY_QC_GPS_LATITUDE_REF, latRef); + } + + /** @hide + * Sets GPS longitude reference coordinate. This will be stored in JPEG EXIF + * header. + * @param lonRef GPS longitude reference coordinate. + */ + public void setGpsLongitudeRef(String lonRef) { + set(KEY_QC_GPS_LONGITUDE_REF, lonRef); + } + + /** @hide + * Sets system timestamp. This will be stored in JPEG EXIF header. + * + * @param dateTime current timestamp (UTC in seconds since January 1, + * 1970). + */ + public void setExifDateTime(String dateTime) { + set(KEY_QC_EXIF_DATETIME, dateTime); + } + + /** @hide + * Gets the current Touch AF/AEC setting. + * + * @return one of TOUCH_AF_AEC_XXX string constant. null if Touch AF/AEC + * setting is not supported. + * + */ + public String getTouchAfAec() { + return get(KEY_QC_TOUCH_AF_AEC); + } + + /** @hide + * Sets the current TOUCH AF/AEC setting. + * + * @param value TOUCH_AF_AEC_XXX string constants. + * + */ + public void setTouchAfAec(String value) { + set(KEY_QC_TOUCH_AF_AEC, value); + } + + /** @hide + * Gets the current redeye reduction setting. + * + * @return one of REDEYE_REDUCTION_XXX string constant. null if redeye reduction + * setting is not supported. + * + */ + public String getRedeyeReductionMode() { + return get(KEY_QC_REDEYE_REDUCTION); + } + + /** @hide + * Sets the redeye reduction. Other parameters may be changed after changing + * redeye reduction. After setting redeye reduction, + * applications should call getParameters to know if some parameters are + * changed. + * + * @param value REDEYE_REDUCTION_XXX string constants. + * + */ + public void setRedeyeReductionMode(String value) { + set(KEY_QC_REDEYE_REDUCTION, value); + } + + /** @hide + * Gets the frame rate mode setting. + * + * @return one of FRAME_RATE_XXX_MODE string constant. null if this + * setting is not supported. + */ + public String getPreviewFrameRateMode() { + return get(KEY_QC_PREVIEW_FRAME_RATE_MODE); + } + + /** @hide + * Sets the frame rate mode. + * + * @param value FRAME_RATE_XXX_MODE string constants. + */ + public void setPreviewFrameRateMode(String value) { + set(KEY_QC_PREVIEW_FRAME_RATE_MODE, value); + } + + /** @hide + * Gets the current auto scene detection setting. + * + * @return one of SCENE_DETECT_XXX string constant. null if auto scene detection + * setting is not supported. + * + */ + public String getSceneDetectMode() { + return get(KEY_QC_SCENE_DETECT); + } + + /** @hide + * Sets the auto scene detect. Other parameters may be changed after changing + * scene detect. After setting auto scene detection, + * applications should call getParameters to know if some parameters are + * changed. + * + * @param value SCENE_DETECT_XXX string constants. + * + */ + public void setSceneDetectMode(String value) { + set(KEY_QC_SCENE_DETECT, value); + } + + /** @hide + * Gets the current hdr bracketing mode setting. + * + * @return current hdr bracketing mode. + * @see #KEY_AE_BRACKET_OFF + * @see #KEY_AE_BRACKET_HDR + * @see #KEY_AE_BRACKET_BRACKATING + */ + public String getAEBracket() { + return get(KEY_QC_AE_BRACKET_HDR); + } + + /** @hide + * Sets the Power mode. + * + * @param value Power mode. + * @see #getPowerMode() + */ + public void setPowerMode(String value) { + set(KEY_QC_POWER_MODE, value); + } + + /** @hide + * Gets the current power mode setting. + * + * @return current power mode. null if power mode setting is not + * supported. + * @see #POWER_MODE_LOW + * @see #POWER_MODE_NORMAL + */ + public String getPowerMode() { + return get(KEY_QC_POWER_MODE); + } + + /** @hide + * Set HDR-Bracketing Level + * + * @param value HDR-Bracketing + */ + public void setAEBracket(String value){ + set(KEY_QC_AE_BRACKET_HDR, value); + } + + /** @hide + * Gets the current ISO setting. + * + * @return one of ISO_XXX string constant. null if ISO + * setting is not supported. + */ + public String getISOValue() { + return get(KEY_QC_ISO_MODE); + } + + /** @hide + * Sets the ISO. + * + * @param iso ISO_XXX string constant. + */ + public void setISOValue(String iso) { + set(KEY_QC_ISO_MODE, iso); + } + + /** @hide + * Sets the exposure time. + * + * @param value exposure time. + */ + public void setExposureTime(int value) { + set(KEY_QC_EXPOSURE_TIME, Integer.toString(value)); + } + + /** @hide + * Gets the current exposure time. + * + * @return exposure time. + */ + public String getExposureTime() { + return get(KEY_QC_EXPOSURE_TIME); + } + + /** @hide + * Gets the min supported exposure time. + * + * @return min supported exposure time. + */ + public String getMinExposureTime() { + return get(KEY_QC_MIN_EXPOSURE_TIME); + } + + /** @hide + * Gets the max supported exposure time. + * + * @return max supported exposure time. + */ + public String getMaxExposureTime() { + return get(KEY_QC_MAX_EXPOSURE_TIME); + } + + /** @hide + * Gets the current LensShade Mode. + * + * @return LensShade Mode + */ + public String getLensShade() { + return get(KEY_QC_LENSSHADE); + } + + /** @hide + * Sets the current LensShade Mode. + * + * @return LensShade Mode + */ + public void setLensShade(String lensshade) { + set(KEY_QC_LENSSHADE, lensshade); + } + + /** @hide + * Gets the current auto exposure setting. + * + * @return one of AUTO_EXPOSURE_XXX string constant. null if auto exposure + * setting is not supported. + */ + public String getAutoExposure() { + return get(KEY_QC_AUTO_EXPOSURE); + } + + /** @hide + * Sets the current auto exposure setting. + * + * @param value AUTO_EXPOSURE_XXX string constants. + */ + public void setAutoExposure(String value) { + set(KEY_QC_AUTO_EXPOSURE, value); + } + + /** @hide + * Gets the current MCE Mode. + * + * @return MCE value + */ + public String getMemColorEnhance() { + return get(KEY_QC_MEMORY_COLOR_ENHANCEMENT); + } + + /** @hide + * Sets the current MCE Mode. + * + * @return MCE Mode + */ + public void setMemColorEnhance(String mce) { + set(KEY_QC_MEMORY_COLOR_ENHANCEMENT, mce); + } + + /** @hide + * Set white balance manual cct value. + * + * @param cct user CCT setting. + */ + public void setWBManualCCT(int cct) { + set(KEY_QC_WB_MANUAL_CCT, Integer.toString(cct)); + } + + /** @hide + * Gets the WB min supported CCT. + * + * @return min cct value. + */ + public String getWBMinCCT() { + return get(KEY_QC_MIN_WB_CCT); + } + + /** @hide + * Gets the WB max supported CCT. + * + * @return max cct value. + */ + public String getMaxWBCCT() { + return get(KEY_QC_MAX_WB_CCT); + } + + /** @hide + * Gets the current WB CCT. + * + * @return CCT value + */ + public String getWBCurrentCCT() { + return get(KEY_QC_WB_MANUAL_CCT); + } + + /** @hide + * Gets the current ZSL Mode. + * + * @return ZSL mode value + */ + public String getZSLMode() { + return get(KEY_QC_ZSL); + } + + /** @hide + * Sets the current ZSL Mode. ZSL mode is set as a 0th bit in KEY_CAMERA_MODE. + * + * @return null + */ + public void setZSLMode(String zsl) { + set(KEY_QC_ZSL, zsl); + } + + /** @hide + * Sets the current Auto HDR Mode. + * @ auto_hdr auto hdr string for enable/disable + * @return null + */ + public void setAutoHDRMode(String auto_hdr){ + set(KEY_QC_AUTO_HDR_ENABLE,auto_hdr); + } + + /** @hide + * Gets the current Camera Mode Flag. Camera mode includes a + * flag(byte) which indicates different camera modes. + * For now support for ZSL added at bit0 + * + * @return Camera Mode. + */ + public String getCameraMode() { + return get(KEY_QC_CAMERA_MODE); + } + + /** @hide + * Sets the current Camera Mode. + * + * @return null + */ + public void setCameraMode(int cameraMode) { + set(KEY_QC_CAMERA_MODE, cameraMode); + } + + private static final int MANUAL_FOCUS_POS_TYPE_INDEX = 0; + private static final int MANUAL_FOCUS_POS_TYPE_DAC = 1; + /** @hide + * Set focus position. + * + * @param pos user setting of focus position. + */ + public void setFocusPosition(int type, int pos) { + set(KEY_QC_MANUAL_FOCUS_POS_TYPE, Integer.toString(type)); + set(KEY_QC_MANUAL_FOCUS_POSITION, Integer.toString(pos)); + } + + /** @hide + * Gets the current focus position. + * + * @return current focus position + */ + public String getCurrentFocusPosition() { + return get(KEY_QC_MANUAL_FOCUS_POSITION); + } + + + /** @hide + * Gets the current HFR Mode. + * + * @return VIDEO_HFR_XXX string constants + */ + public String getVideoHighFrameRate() { + return get(KEY_QC_VIDEO_HIGH_FRAME_RATE); + } + + /** @hide + * Sets the current HFR Mode. + * + * @param hfr VIDEO_HFR_XXX string constants + */ + public void setVideoHighFrameRate(String hfr) { + set(KEY_QC_VIDEO_HIGH_FRAME_RATE, hfr); + } + + /** @hide + * Gets the current Video HDR Mode. + * + * @return Video HDR mode value + */ + public String getVideoHDRMode() { + return get(KEY_QC_VIDEO_HDR); + } + + /** @hide + * Sets the current Video HDR Mode. + * + * @return null + */ + public void setVideoHDRMode(String videohdr) { + set(KEY_QC_VIDEO_HDR, videohdr); + } + + /** @hide + * Gets the current DENOISE setting. + * + * @return one of DENOISE_XXX string constant. null if Denoise + * setting is not supported. + * + */ + public String getDenoise() { + return get(KEY_QC_DENOISE); + } + + /** @hide + * Gets the current Continuous AF setting. + * + * @return one of CONTINUOUS_AF_XXX string constant. null if continuous AF + * setting is not supported. + * + */ + public String getContinuousAf() { + return get(KEY_QC_CONTINUOUS_AF); + } + + /** @hide + * Sets the current Denoise mode. + * @param value DENOISE_XXX string constants. + * + */ + + public void setDenoise(String value) { + set(KEY_QC_DENOISE, value); + } + + /** @hide + * Sets the current Continuous AF mode. + * @param value CONTINUOUS_AF_XXX string constants. + * + */ + public void setContinuousAf(String value) { + set(KEY_QC_CONTINUOUS_AF, value); + } + + /** @hide + * Gets the current selectable zone af setting. + * + * @return one of SELECTABLE_ZONE_AF_XXX string constant. null if selectable zone af + * setting is not supported. + */ + public String getSelectableZoneAf() { + return get(KEY_QC_SELECTABLE_ZONE_AF); + } + + /** @hide + * Sets the current selectable zone af setting. + * + * @param value SELECTABLE_ZONE_AF_XXX string constants. + */ + public void setSelectableZoneAf(String value) { + set(KEY_QC_SELECTABLE_ZONE_AF, value); + } + + /** @hide + * Gets the current face detection setting. + * + * @return one of FACE_DETECTION_XXX string constant. null if face detection + * setting is not supported. + * + */ + public String getFaceDetectionMode() { + return get(KEY_QC_FACE_DETECTION); + } + + /** @hide + * Sets the auto scene detect. Other settings like Touch AF/AEC might be + * changed after setting face detection. + * + * @param value FACE_DETECTION_XXX string constants. + * + */ + public void setFaceDetectionMode(String value) { + set(KEY_QC_FACE_DETECTION, value); + } + + /** @hide + * Gets the current video rotation setting. + * + * @return one of VIDEO_QC_ROTATION_XXX string constant. null if video rotation + * setting is not supported. + */ + public String getVideoRotation() { + return get(KEY_QC_VIDEO_ROTATION); + } + + /** @hide + * Sets the current video rotation setting. + * + * @param value VIDEO_QC_ROTATION_XXX string constants. + */ + public void setVideoRotation(String value) { + set(KEY_QC_VIDEO_ROTATION, value); + } + /** @hide + * Gets the supported video rotation modes. + * + * @return a List of VIDEO_QC_ROTATION_XXX string constant. null if this + * setting is not supported. + */ + public List getSupportedVideoRotationValues() { + String str = get(KEY_QC_VIDEO_ROTATION + SUPPORTED_VALUES_SUFFIX); + return split(str); + } + + // Splits a comma delimited string to an ArrayList of Coordinate. + // Return null if the passing string is null or the Coordinate is 0. + private ArrayList splitCoordinate(String str) { + if (str == null) return null; + TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); + splitter.setString(str); + ArrayList coordinateList = new ArrayList(); + for (String s : splitter) { + Coordinate coordinate = strToCoordinate(s); + if (coordinate != null) coordinateList.add(coordinate); + } + if (coordinateList.size() == 0) return null; + return coordinateList; + } + + // Parses a string (ex: "500x500") to Coordinate object. + // Return null if the passing string is null. + private Coordinate strToCoordinate(String str) { + if (str == null) return null; + + int pos = str.indexOf('x'); + if (pos != -1) { + String x = str.substring(0, pos); + String y = str.substring(pos + 1); + return new Coordinate(Integer.parseInt(x), + Integer.parseInt(y)); + } + Log.e(TAG, "Invalid Coordinate parameter string=" + str); + return null; + } + /* ### QC ADD-ONS: END */ }; } diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java index 1142a07bc66c..57b5493238aa 100644 --- a/core/java/android/hardware/biometrics/BiometricPrompt.java +++ b/core/java/android/hardware/biometrics/BiometricPrompt.java @@ -648,15 +648,8 @@ private void authenticateInternal(@Nullable CryptoObject crypto, mExecutor = executor; mAuthenticationCallback = callback; final long sessionId = crypto != null ? crypto.getOpId() : 0; - if (BiometricManager.hasBiometrics(mContext)) { - mService.authenticate(mToken, sessionId, userId, mBiometricServiceReceiver, - mContext.getOpPackageName(), mBundle, confirmDeviceCredentialCallback); - } else { - mExecutor.execute(() -> { - callback.onAuthenticationError(BiometricPrompt.BIOMETRIC_ERROR_HW_NOT_PRESENT, - mContext.getString(R.string.biometric_error_hw_unavailable)); - }); - } + mService.authenticate(mToken, sessionId, userId, mBiometricServiceReceiver, + mContext.getOpPackageName(), mBundle, confirmDeviceCredentialCallback); } catch (RemoteException e) { Log.e(TAG, "Remote exception while authenticating", e); mExecutor.execute(() -> { diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java index c8276b25c52d..17ca1870ab4f 100644 --- a/core/java/android/hardware/camera2/CameraManager.java +++ b/core/java/android/hardware/camera2/CameraManager.java @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemService; +import android.app.ActivityThread; import android.content.Context; import android.hardware.CameraInfo; import android.hardware.CameraStatus; @@ -38,6 +39,8 @@ import android.os.ServiceManager; import android.os.ServiceSpecificException; import android.os.SystemProperties; +import android.text.TextUtils; +import android.util.Log; import android.util.ArrayMap; import android.util.Log; import android.util.Size; @@ -1006,8 +1009,24 @@ public String[] getCameraIdList() { // Try to make sure we have an up-to-date list of camera devices. connectCameraServiceLocked(); + boolean exposeAuxCamera = true; + String packageName = ActivityThread.currentOpPackageName(); + String packageList = SystemProperties.get("vendor.camera.aux.packagelist", ""); + String packageBlacklist = SystemProperties.get("vendor.camera.aux.packageblacklist", ""); + if (!packageList.isEmpty()) { + exposeAuxCamera = false; + if (Arrays.asList(packageList.split(",")).contains(packageName)) { + exposeAuxCamera = true; + } + } else if (!packageBlacklist.isEmpty()) { + exposeAuxCamera = true; + if (Arrays.asList(packageBlacklist.split(",")).contains(packageName)) { + exposeAuxCamera = false; + } + } int idCount = 0; for (int i = 0; i < mDeviceStatus.size(); i++) { + if(!exposeAuxCamera && (i == 2)) break; int status = mDeviceStatus.valueAt(i); if (status == ICameraServiceListener.STATUS_NOT_PRESENT || status == ICameraServiceListener.STATUS_ENUMERATING) continue; @@ -1016,6 +1035,7 @@ public String[] getCameraIdList() { cameraIds = new String[idCount]; idCount = 0; for (int i = 0; i < mDeviceStatus.size(); i++) { + if(!exposeAuxCamera && (i == 2)) break; int status = mDeviceStatus.valueAt(i); if (status == ICameraServiceListener.STATUS_NOT_PRESENT || status == ICameraServiceListener.STATUS_ENUMERATING) continue; @@ -1213,6 +1233,32 @@ private void updateCallbackLocked(AvailabilityCallback callback, Executor execut } private void onStatusChangedLocked(int status, String id) { + /* Force to ignore the last mono/aux camera status update + * if the package name does not falls in this bucket + */ + boolean exposeMonoCamera = true; + String packageName = ActivityThread.currentOpPackageName(); + String packageList = SystemProperties.get("vendor.camera.aux.packagelist", ""); + String packageBlacklist = SystemProperties.get("vendor.camera.aux.packageblacklist", ""); + if (!packageList.isEmpty()) { + exposeMonoCamera = false; + if (Arrays.asList(packageList.split(",")).contains(packageName)) { + exposeMonoCamera = true; + } + } else if (!packageBlacklist.isEmpty()) { + exposeMonoCamera = true; + if (Arrays.asList(packageBlacklist.split(",")).contains(packageName)) { + exposeMonoCamera = false; + } + } + + if (exposeMonoCamera == false) { + if (Integer.parseInt(id) >= 2) { + Log.w(TAG, "[soar.cts] ignore the status update of camera: " + id); + return; + } + } + if (DEBUG) { Log.v(TAG, String.format("Camera id %s has status changed to 0x%x", id, status)); diff --git a/core/java/android/hardware/display/AmbientDisplayConfiguration.java b/core/java/android/hardware/display/AmbientDisplayConfiguration.java index 3e995b624112..43e284e269c6 100644 --- a/core/java/android/hardware/display/AmbientDisplayConfiguration.java +++ b/core/java/android/hardware/display/AmbientDisplayConfiguration.java @@ -213,4 +213,9 @@ private boolean boolSettingDefaultOff(String name, int user) { private boolean boolSetting(String name, int user, int def) { return Settings.Secure.getIntForUser(mContext.getContentResolver(), name, def, user) != 0; } + + public boolean isAmbientGestureEnabled(int user) { + return Settings.System.getIntForUser(mContext.getContentResolver(), + Settings.System.AMBIENT_WAKE_GESTURES, 1, user) != 0; + } } diff --git a/core/java/android/nfc/INfcAdapter.aidl b/core/java/android/nfc/INfcAdapter.aidl index 0b2cfdd9ece3..c758031aacfa 100644 --- a/core/java/android/nfc/INfcAdapter.aidl +++ b/core/java/android/nfc/INfcAdapter.aidl @@ -1,4 +1,7 @@ /* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Not a Contribution. + * * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,6 +34,7 @@ import android.nfc.INfcUnlockHandler; import android.nfc.ITagRemovedCallback; import android.nfc.INfcDta; import android.os.Bundle; +import android.os.IBinder; /** * @hide @@ -42,6 +46,8 @@ interface INfcAdapter INfcFCardEmulation getNfcFCardEmulationInterface(); INfcAdapterExtras getNfcAdapterExtrasInterface(in String pkg); INfcDta getNfcDtaInterface(in String pkg); + IBinder getNfcAdapterVendorInterface(in String vendor); + int getState(); boolean disable(boolean saveState); boolean enable(); diff --git a/core/java/android/nfc/cardemulation/AidGroup.java b/core/java/android/nfc/cardemulation/AidGroup.java index 77b5552cd27b..f75f79e0806b 100644 --- a/core/java/android/nfc/cardemulation/AidGroup.java +++ b/core/java/android/nfc/cardemulation/AidGroup.java @@ -1,4 +1,7 @@ /* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Not a Contribution. + * * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,7 +41,7 @@ * * @hide */ -public final class AidGroup implements Parcelable { +public class AidGroup implements Parcelable { /** * The maximum number of AIDs that can be present in any one group. */ @@ -47,11 +50,11 @@ public final class AidGroup implements Parcelable { static final String TAG = "AidGroup"; @UnsupportedAppUsage - final List aids; + protected List aids; @UnsupportedAppUsage - final String category; + protected String category; @UnsupportedAppUsage - final String description; + protected String description; /** * Creates a new AidGroup object. diff --git a/core/java/android/nfc/cardemulation/ApduServiceInfo.java b/core/java/android/nfc/cardemulation/ApduServiceInfo.java index 4675600fe1d6..d988b954e3fd 100644 --- a/core/java/android/nfc/cardemulation/ApduServiceInfo.java +++ b/core/java/android/nfc/cardemulation/ApduServiceInfo.java @@ -1,4 +1,7 @@ /* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Not a Contribution. + * * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,24 +50,24 @@ /** * @hide */ -public final class ApduServiceInfo implements Parcelable { +public class ApduServiceInfo implements Parcelable { static final String TAG = "ApduServiceInfo"; /** * The service that implements this */ @UnsupportedAppUsage - final ResolveInfo mService; + protected ResolveInfo mService; /** * Description of the service */ - final String mDescription; + protected String mDescription; /** * Whether this service represents AIDs running on the host CPU */ - final boolean mOnHost; + protected boolean mOnHost; /** * Offhost reader name. @@ -82,33 +85,33 @@ public final class ApduServiceInfo implements Parcelable { * Mapping from category to static AID group */ @UnsupportedAppUsage - final HashMap mStaticAidGroups; + protected HashMap mStaticAidGroups; /** * Mapping from category to dynamic AID group */ @UnsupportedAppUsage - final HashMap mDynamicAidGroups; + protected HashMap mDynamicAidGroups; /** * Whether this service should only be started when the device is unlocked. */ - final boolean mRequiresDeviceUnlock; + protected boolean mRequiresDeviceUnlock; /** * The id of the service banner specified in XML. */ - final int mBannerResourceId; + protected int mBannerResourceId; /** * The uid of the package the service belongs to */ - final int mUid; + protected int mUid; /** * Settings Activity for this service */ - final String mSettingsActivityName; + protected String mSettingsActivityName; /** * @hide diff --git a/core/java/android/nfc/tech/MifareClassic.java b/core/java/android/nfc/tech/MifareClassic.java index 080e058737b6..9cae043c4bdd 100644 --- a/core/java/android/nfc/tech/MifareClassic.java +++ b/core/java/android/nfc/tech/MifareClassic.java @@ -1,4 +1,6 @@ /* + * Copyright (C) 2018 NXP Semiconductors + * The original Work has been changed by NXP Semiconductors. * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -173,6 +175,10 @@ public MifareClassic(Tag tag) throws RemoteException { mType = TYPE_CLASSIC; mSize = SIZE_4K; break; + case 0x19: + mType = TYPE_CLASSIC; + mSize = SIZE_2K; + break; case 0x28: mType = TYPE_CLASSIC; mSize = SIZE_1K; diff --git a/core/java/android/nfc/tech/NfcA.java b/core/java/android/nfc/tech/NfcA.java index 88730f9af3df..819e9e31b6e6 100644 --- a/core/java/android/nfc/tech/NfcA.java +++ b/core/java/android/nfc/tech/NfcA.java @@ -1,4 +1,6 @@ /* + * Copyright (C) 2018 NXP Semiconductors + * The original Work has been changed by NXP Semiconductors. * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -66,8 +68,15 @@ public static NfcA get(Tag tag) { /** @hide */ public NfcA(Tag tag) throws RemoteException { super(tag, TagTechnology.NFC_A); - Bundle extras = tag.getTechExtras(TagTechnology.NFC_A); - mSak = extras.getShort(EXTRA_SAK); + Bundle extras; + mSak = 0; + if(tag.hasTech(TagTechnology.MIFARE_CLASSIC)) + { + extras = tag.getTechExtras(TagTechnology.MIFARE_CLASSIC); + mSak = extras.getShort(EXTRA_SAK); + } + extras = tag.getTechExtras(TagTechnology.NFC_A); + mSak |= extras.getShort(EXTRA_SAK); mAtqa = extras.getByteArray(EXTRA_ATQA); } diff --git a/core/java/android/os/BaseBundle.java b/core/java/android/os/BaseBundle.java index 7f63f8fb9e28..116498f32ceb 100644 --- a/core/java/android/os/BaseBundle.java +++ b/core/java/android/os/BaseBundle.java @@ -298,7 +298,14 @@ private void initializeFromParcelLocked(@NonNull Parcel parcelledData, boolean r } else { throw e; } - } finally { + } catch (RuntimeException e) { + if (sShouldDefuse && (e.getCause() instanceof ClassNotFoundException)) { + Log.w(TAG, "Failed to parse Bundle, but defusing quietly", e); + map.erase(); + } else { + throw e; + } + }finally { mMap = map; if (recycleParcel) { recycleParcel(parcelledData); diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 176c2b7db054..31403773aff3 100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -62,6 +62,12 @@ public class Build { /** The name of the underlying board, like "goldfish". */ public static final String BOARD = getString("ro.product.board"); + /** + * The build date + * @hide + */ + public static final String DATE = getString("ro.build.date"); + /** * The name of the instruction set (CPU type + ABI convention) of native code. * @@ -1076,7 +1082,7 @@ public static boolean isBuildConsistent() { return result == 0; } - final String system = SystemProperties.get("ro.build.fingerprint"); + final String system = SystemProperties.get("ro.system.build.fingerprint"); final String vendor = SystemProperties.get("ro.vendor.build.fingerprint"); final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint"); final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader"); @@ -1085,7 +1091,7 @@ public static boolean isBuildConsistent() { final String currentRadio = SystemProperties.get("gsm.version.baseband"); if (TextUtils.isEmpty(system)) { - Slog.e(TAG, "Required ro.build.fingerprint is empty!"); + Slog.e(TAG, "Required ro.system.build.fingerprint is empty!"); return false; } diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java index f789b723f732..d6bce25c8305 100644 --- a/core/java/android/os/FileUtils.java +++ b/core/java/android/os/FileUtils.java @@ -1262,11 +1262,13 @@ public static boolean createDir(File dir) { public static long roundStorageSize(long size) { long val = 1; long pow = 1; - while ((val * pow) < size) { + long pow1024 = 1; + while ((val * pow1024) < size) { val <<= 1; if (val > 512) { val = 1; pow *= 1000; + pow1024 *= 1024; } } return val * pow; diff --git a/core/java/android/os/HwParcel.java b/core/java/android/os/HwParcel.java index cfb582ef442e..5e8929c6c999 100644 --- a/core/java/android/os/HwParcel.java +++ b/core/java/android/os/HwParcel.java @@ -23,6 +23,8 @@ import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; +import dalvik.annotation.optimization.FastNative; + import libcore.util.NativeAllocationRegistry; import java.lang.annotation.Retention; @@ -72,46 +74,54 @@ public HwParcel() { /** * Writes an interface token into the parcel used to verify that - * a transaction has made it to the write type of interface. + * a transaction has made it to the right type of interface. * * @param interfaceName fully qualified name of interface message * is being sent to. */ + @FastNative public native final void writeInterfaceToken(String interfaceName); /** * Writes a boolean value to the end of the parcel. * @param val to write */ + @FastNative public native final void writeBool(boolean val); /** * Writes a byte value to the end of the parcel. * @param val to write */ + @FastNative public native final void writeInt8(byte val); /** * Writes a short value to the end of the parcel. * @param val to write */ + @FastNative public native final void writeInt16(short val); /** * Writes a int value to the end of the parcel. * @param val to write */ + @FastNative public native final void writeInt32(int val); /** * Writes a long value to the end of the parcel. * @param val to write */ + @FastNative public native final void writeInt64(long val); /** * Writes a float value to the end of the parcel. * @param val to write */ + @FastNative public native final void writeFloat(float val); /** * Writes a double value to the end of the parcel. * @param val to write */ + @FastNative public native final void writeDouble(double val); /** * Writes a String value to the end of the parcel. @@ -120,6 +130,7 @@ public HwParcel() { * * @param val to write */ + @FastNative public native final void writeString(String val); /** * Writes a native handle (without duplicating the underlying @@ -127,42 +138,50 @@ public HwParcel() { * * @param val to write */ + @FastNative public native final void writeNativeHandle(@Nullable NativeHandle val); /** * Writes an array of boolean values to the end of the parcel. * @param val to write */ + @FastNative private native final void writeBoolVector(boolean[] val); /** * Writes an array of byte values to the end of the parcel. * @param val to write */ + @FastNative private native final void writeInt8Vector(byte[] val); /** * Writes an array of short values to the end of the parcel. * @param val to write */ + @FastNative private native final void writeInt16Vector(short[] val); /** * Writes an array of int values to the end of the parcel. * @param val to write */ + @FastNative private native final void writeInt32Vector(int[] val); /** * Writes an array of long values to the end of the parcel. * @param val to write */ + @FastNative private native final void writeInt64Vector(long[] val); /** * Writes an array of float values to the end of the parcel. * @param val to write */ + @FastNative private native final void writeFloatVector(float[] val); /** * Writes an array of double values to the end of the parcel. * @param val to write */ + @FastNative private native final void writeDoubleVector(double[] val); /** * Writes an array of String values to the end of the parcel. @@ -171,6 +190,7 @@ public HwParcel() { * * @param val to write */ + @FastNative private native final void writeStringVector(String[] val); /** * Writes an array of native handles to the end of the parcel. @@ -179,6 +199,7 @@ public HwParcel() { * * @param val array of {@link NativeHandle} objects to write */ + @FastNative private native final void writeNativeHandleVector(NativeHandle[] val); /** @@ -299,6 +320,7 @@ public final void writeNativeHandleVector(@NonNull ArrayList val) * Write a hwbinder object to the end of the parcel. * @param binder value to write */ + @FastNative public native final void writeStrongBinder(IHwBinder binder); /** @@ -314,48 +336,56 @@ public final void writeNativeHandleVector(@NonNull ArrayList val) * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final boolean readBool(); /** * Reads a byte value from the current location in the parcel. * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final byte readInt8(); /** * Reads a short value from the current location in the parcel. * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final short readInt16(); /** * Reads a int value from the current location in the parcel. * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final int readInt32(); /** * Reads a long value from the current location in the parcel. * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final long readInt64(); /** * Reads a float value from the current location in the parcel. * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final float readFloat(); /** * Reads a double value from the current location in the parcel. * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final double readDouble(); /** * Reads a String value from the current location in the parcel. * @return value parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final String readString(); /** * Reads a native handle (without duplicating the underlying file @@ -366,6 +396,7 @@ public final void writeNativeHandleVector(@NonNull ArrayList val) * @return a {@link NativeHandle} instance parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final @Nullable NativeHandle readNativeHandle(); /** * Reads an embedded native handle (without duplicating the underlying @@ -379,6 +410,7 @@ public final void writeNativeHandleVector(@NonNull ArrayList val) * @return a {@link NativeHandle} instance parsed from the parcel * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final @Nullable NativeHandle readEmbeddedNativeHandle( long parentHandle, long offset); @@ -387,54 +419,63 @@ public final void writeNativeHandleVector(@NonNull ArrayList val) * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final boolean[] readBoolVectorAsArray(); /** * Reads an array of byte values from the parcel. * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final byte[] readInt8VectorAsArray(); /** * Reads an array of short values from the parcel. * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final short[] readInt16VectorAsArray(); /** * Reads an array of int values from the parcel. * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final int[] readInt32VectorAsArray(); /** * Reads an array of long values from the parcel. * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final long[] readInt64VectorAsArray(); /** * Reads an array of float values from the parcel. * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final float[] readFloatVectorAsArray(); /** * Reads an array of double values from the parcel. * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final double[] readDoubleVectorAsArray(); /** * Reads an array of String values from the parcel. * @return array of parsed values * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final String[] readStringVectorAsArray(); /** * Reads an array of native handles from the parcel. * @return array of {@link NativeHandle} objects * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative private native final NativeHandle[] readNativeHandleAsArray(); /** @@ -537,6 +578,7 @@ public final ArrayList readStringVector() { * @return binder object read from parcel or null if no binder can be read * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final IHwBinder readStrongBinder(); /** @@ -544,6 +586,7 @@ public final ArrayList readStringVector() { * @return blob of size expectedSize * @throws IllegalArgumentException if the parcel has no more data */ + @FastNative public native final HwBlob readBuffer(long expectedSize); /** @@ -559,6 +602,7 @@ public final ArrayList readStringVector() { * @throws NullPointerException if the transaction specified the blob to be null * but nullable is false */ + @FastNative public native final HwBlob readEmbeddedBuffer( long expectedSize, long parentHandle, long offset, boolean nullable); @@ -567,26 +611,31 @@ public native final HwBlob readEmbeddedBuffer( * Write a buffer into the transaction. * @param blob blob to write into the parcel. */ + @FastNative public native final void writeBuffer(HwBlob blob); /** * Write a status value into the blob. * @param status value to write */ + @FastNative public native final void writeStatus(int status); /** * @throws IllegalArgumentException if a success vaue cannot be read * @throws RemoteException if success value indicates a transaction error */ + @FastNative public native final void verifySuccess(); /** * Should be called to reduce memory pressure when this object no longer needs * to be written to. */ + @FastNative public native final void releaseTemporaryStorage(); /** * Should be called when object is no longer needed to reduce possible memory * pressure if the Java GC does not get to this object in time. */ + @FastNative public native final void release(); /** @@ -597,6 +646,7 @@ public native final HwBlob readEmbeddedBuffer( // Returns address of the "freeFunction". private static native final long native_init(); + @FastNative private native final void native_setup(boolean allocate); static { diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index e1d605e1c99d..3d173335b39d 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -45,6 +45,7 @@ interface IPowerManager @UnsupportedAppUsage void userActivity(long time, int event, int flags); void wakeUp(long time, int reason, String details, String opPackageName); + void wakeUpWithProximityCheck(long time, int reason, String details, String opPackageName); @UnsupportedAppUsage void goToSleep(long time, int reason, int flags); void nap(long time); @@ -63,6 +64,7 @@ interface IPowerManager @UnsupportedAppUsage void reboot(boolean confirm, String reason, boolean wait); void rebootSafeMode(boolean confirm, boolean wait); + void rebootCustom(boolean confirm, String reason, boolean wait); void shutdown(boolean confirm, String reason, boolean wait); void crash(String message); int getLastShutdownReason(); diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 45e777c7d01b..755dd96af9eb 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -309,6 +309,15 @@ public final class PowerManager { */ public static final int GO_TO_SLEEP_REASON_MIN = 0; + /** + * @hide + * User activity flag: Certain hardware buttons are not supposed to + * activate hardware button illumination. This flag indicates a + * button event from one of those buttons. + * @hide + */ + public static final int USER_ACTIVITY_FLAG_NO_BUTTON_LIGHTS = 1 << 2; + /** * Go to sleep reason code: Going to sleep due by application request. * @hide @@ -519,6 +528,18 @@ public WakeData(long wakeTime, @WakeReason int wakeReason) { */ public static final String REBOOT_RECOVERY = "recovery"; + /** + * The value to pass as the 'reason' argument to reboot() to + * reboot into bootloader mode + *

+ * Requires the {@link android.Manifest.permission#RECOVERY} + * permission (in addition to + * {@link android.Manifest.permission#REBOOT}). + *

+ * @hide + */ + public static final String REBOOT_BOOTLOADER = "bootloader"; + /** * The value to pass as the 'reason' argument to reboot() to reboot into * recovery mode for applying system updates. @@ -844,6 +865,15 @@ public int getDefaultScreenBrightnessForVrSetting() { com.android.internal.R.integer.config_screenBrightnessForVrSettingDefault); } + /** + * Gets the default button brightness value. + * @hide + */ + public int getDefaultButtonBrightness() { + return mContext.getResources().getInteger( + com.android.internal.R.integer.config_buttonBrightnessSettingDefault); + } + /** * Creates a new wake lock with the specified level and flags. *

@@ -1152,6 +1182,22 @@ public void wakeUp(long time, @WakeReason int reason, String details) { } } + /** + * Forces the device to wake up from sleep only if + * nothing is blocking the proximity sensor + * + * @see #wakeUp + * + * @hide + */ + public void wakeUpWithProximityCheck(long time, int reason, String details) { + try { + mService.wakeUpWithProximityCheck(time, reason, details, mContext.getOpPackageName()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + /** * Forces the device to start napping. *

@@ -1354,6 +1400,24 @@ public void rebootSafeMode() { } } + /** + * Reboot the device with custom progress meassges. + * Will not return if the reboot is successful. + *

+ * Requires the {@link android.Manifest.permission#REBOOT} permission. + *

+ * + * @param reason code to pass to the kernel (e.g., "recovery") to + * request special boot modes, or null. + * @hide + */ + public void rebootCustom(String reason) { + try { + mService.rebootCustom(false, reason, true); + } catch (RemoteException e) { + } + } + /** * Returns true if the device is currently in power save mode. When in this mode, * applications should reduce their functionality in order to conserve battery as diff --git a/core/java/android/os/PowerManagerInternal.java b/core/java/android/os/PowerManagerInternal.java index 651c4cacf383..af351ee4c6ad 100644 --- a/core/java/android/os/PowerManagerInternal.java +++ b/core/java/android/os/PowerManagerInternal.java @@ -106,6 +106,16 @@ public static boolean isInteractive(int wakefulness) { */ public abstract void setScreenBrightnessOverrideFromWindowManager(int brightness); + /** + * Used by the window manager to override the button brightness based on the + * current foreground activity. + * + * This method must only be called by the window manager. + * + * @param brightness The overridden brightness, or -1 to disable the override. + */ + public abstract void setButtonBrightnessOverrideFromWindowManager(int brightness); + /** * Used by the window manager to override the user activity timeout based on the * current foreground activity. It can only be used to make the timeout shorter diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 48fc2a6bf449..9c175cea18f6 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -447,7 +447,7 @@ public static void processPackage(Context context, final Handler handler) throws IOException { String filename = packageFile.getCanonicalPath(); - if (!filename.startsWith("/data/")) { + if (!filename.startsWith("/data/") || !SystemProperties.get("sys.ota.disable_uncrypt", "0").equals("0")) { return; } @@ -562,7 +562,7 @@ public static void installPackage(Context context, File packageFile, boolean pro // If the package is on the /data partition, the package needs to // be processed (i.e. uncrypt'd). The caller specifies if that has // been done in 'processed' parameter. - if (filename.startsWith("/data/")) { + if (SystemProperties.get("sys.ota.disable_uncrypt", "0").equals("0") && filename.startsWith("/data/")) { if (processed) { if (!BLOCK_MAP_FILE.exists()) { Log.e(TAG, "Package claimed to have been processed but failed to find " @@ -645,7 +645,7 @@ public static void scheduleUpdateOnBoot(Context context, File packageFile) // If the package is on the /data partition, use the block map file as // the package name instead. - if (filename.startsWith("/data/")) { + if (SystemProperties.get("sys.ota.disable_uncrypt", "0").equals("0") && filename.startsWith("/data/")) { filename = "@/cache/recovery/block.map"; } diff --git a/core/java/android/os/storage/DiskInfo.java b/core/java/android/os/storage/DiskInfo.java index b797324c8007..7da5a422bf15 100644 --- a/core/java/android/os/storage/DiskInfo.java +++ b/core/java/android/os/storage/DiskInfo.java @@ -50,6 +50,8 @@ public class DiskInfo implements Parcelable { public static final int FLAG_DEFAULT_PRIMARY = 1 << 1; public static final int FLAG_SD = 1 << 2; public static final int FLAG_USB = 1 << 3; + public static final int FLAG_EMMC = 1 << 4; + public static final int FLAG_NON_REMOVABLE = 1 << 5; public final String id; @UnsupportedAppUsage @@ -152,6 +154,10 @@ public boolean isUsb() { return (flags & FLAG_USB) != 0; } + public boolean isNonRemovable() { + return (flags & FLAG_NON_REMOVABLE) != 0; + } + @Override public String toString() { final CharArrayWriter writer = new CharArrayWriter(); diff --git a/core/java/android/os/storage/IStorageManager.aidl b/core/java/android/os/storage/IStorageManager.aidl index 92fecaddff22..bbc936d76e1c 100644 --- a/core/java/android/os/storage/IStorageManager.aidl +++ b/core/java/android/os/storage/IStorageManager.aidl @@ -193,4 +193,5 @@ interface IStorageManager { void startCheckpoint(int numTries) = 85; boolean needsCheckpoint() = 86; void abortChanges(in String message, boolean retry) = 87; + void clearUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 88; } diff --git a/core/java/android/preference/MultiSelectListPreference.java b/core/java/android/preference/MultiSelectListPreference.java index 3d807172d80b..e7d1c432c934 100644 --- a/core/java/android/preference/MultiSelectListPreference.java +++ b/core/java/android/preference/MultiSelectListPreference.java @@ -227,7 +227,7 @@ protected void onDialogClosed(boolean positiveResult) { @Override protected Object onGetDefaultValue(TypedArray a, int index) { final CharSequence[] defaultValues = a.getTextArray(index); - final int valueCount = defaultValues.length; + final int valueCount = defaultValues != null ? defaultValues.length : 0; final Set result = new HashSet(); for (int i = 0; i < valueCount; i++) { diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java index 9a384c6d9d79..e401ac3d4036 100644 --- a/core/java/android/provider/Downloads.java +++ b/core/java/android/provider/Downloads.java @@ -645,6 +645,11 @@ public static boolean isStatusCompleted(int status) { */ public static final int STATUS_QUEUED_FOR_WIFI = 196; + /** + * This download is paused manually. + */ + public static final int STATUS_PAUSED_MANUAL = 197; + /** * This download couldn't be completed due to insufficient storage * space. Typically, this is because the SD card is full. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index eb6a5394bfef..a72504c981a0 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2801,6 +2801,32 @@ public static int getIntForUser(ContentResolver cr, String name, int userHandle) } } + /** + * @hide + * Convenience function for retrieving a single system settings value + * as a boolean. Note that internally setting values are always + * stored as strings; this function converts the string to a boolean + * for you. It will only return true if the stored value is "1" + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to retrieve. + * @param def Value to return if the setting is not defined. + * + * @return The setting's current value, or 'def' if it is not defined + * or not a valid integer. + */ + public static boolean getBoolean(ContentResolver cr, String name, boolean def) { + String v = getString(cr, name); + try { + if(v != null) + return "1".equals(v); + else + return def; + } catch (NumberFormatException e) { + return def; + } + } + /** * Convenience function for updating a single settings value as an * integer. This will either create a new entry in the table if the @@ -2825,6 +2851,24 @@ public static boolean putIntForUser(ContentResolver cr, String name, int value, return putStringForUser(cr, name, Integer.toString(value), userHandle); } + /** + * @hide + * Convenience function for updating a single settings value as a + * boolean. This will either create a new entry in the table if the + * given name does not exist, or modify the value of the existing row + * with that name. Note that internally setting values are always + * stored as strings, so this function converts the given value to a + * string (1 or 0) before storing it. + * + * @param cr The ContentResolver to access. + * @param name The name of the setting to modify. + * @param value The new value for the setting. + * @return true if the value was set, false on database errors + */ + public static boolean putBoolean(ContentResolver cr, String name, boolean value) { + return putString(cr, name, value ? "1" : "0"); + } + /** * Convenience function for retrieving a single system settings value * as a {@code long}. Note that internally setting values are always @@ -3393,6 +3437,27 @@ public boolean validate(String value) { public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; + /** + * Whether to scramble a pin unlock layout + * @hide + */ + public static final String LOCKSCREEN_PIN_SCRAMBLE_LAYOUT = + "lockscreen_scramble_pin_layout"; + + /** + * Whether to use the custom quick unlock screen control + * @hide + */ + public static final String LOCKSCREEN_QUICK_UNLOCK_CONTROL = + "lockscreen_quick_unlock_control"; + + /** + * Unlock keystore with fingerprint after reboot + * @hide + */ + public static final String FP_UNLOCK_KEYSTORE = + "fp_unlock_keystore"; + /** * A formatted string of the next alarm that is set, or the empty string * if there is no alarm set. @@ -4223,6 +4288,30 @@ public boolean validate(@Nullable String value) { /** @hide */ public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * Whether to enable Smart Pixels + * @hide + */ + public static final String SMART_PIXELS_ENABLE = "smart_pixels_enable"; + + /** + * Smart Pixels pattern + * @hide + */ + public static final String SMART_PIXELS_PATTERN = "smart_pixels_pattern"; + + /** + * Smart Pixels Shift Timeout + * @hide + */ + public static final String SMART_PIXELS_SHIFT_TIMEOUT = "smart_pixels_shift_timeout"; + + /** + * Whether Smart Pixels should enable on power saver mode + * @hide + */ + public static final String SMART_PIXELS_ON_POWER_SAVE = "smart_pixels_on_power_save"; + /** * Whether the notification LED should repeatedly flash when a notification is * pending. The value is boolean (1 or 0). @@ -4330,167 +4419,859 @@ public boolean validate(@Nullable String value) { public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND} - * instead + * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND} + * instead + * @hide + */ + @Deprecated + @UnsupportedAppUsage + public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND; + + /** + * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND} + * instead + * @hide + */ + @Deprecated + @UnsupportedAppUsage + public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND; + + /** + * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND} + * instead + * @hide + */ + @Deprecated + @UnsupportedAppUsage + public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; + + /** + * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} + * instead + * @hide + */ + @Deprecated + @UnsupportedAppUsage + public static final String LOCK_SOUND = Global.LOCK_SOUND; + + /** + * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} + * instead + * @hide + */ + @Deprecated + @UnsupportedAppUsage + public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; + + /** + * Receive incoming SIP calls? + * 0 = no + * 1 = yes + * @hide + */ + public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; + + /** @hide */ + public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * Call Preference String. + * "SIP_ALWAYS" : Always use SIP with network access + * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address + * @hide + */ + public static final String SIP_CALL_OPTIONS = "sip_call_options"; + + /** @hide */ + public static final Validator SIP_CALL_OPTIONS_VALIDATOR = + new SettingsValidators.DiscreteValueValidator( + new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"}); + + /** + * One of the sip call options: Always use SIP with network access. + * @hide + */ + public static final String SIP_ALWAYS = "SIP_ALWAYS"; + + /** @hide */ + public static final Validator SIP_ALWAYS_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * One of the sip call options: Only if destination is a SIP address. + * @hide + */ + public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; + + /** @hide */ + public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that + * the user should be prompted each time a call is made whether it should be placed using + * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with + * SIP_ADDRESS_ONLY. + * @hide + */ + @Deprecated + public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; + + /** @hide */ + public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * Pointer speed setting. + * This is an integer value in a range between -7 and +7, so there are 15 possible values. + * -7 = slowest + * 0 = default speed + * +7 = fastest + * @hide + */ + @UnsupportedAppUsage + public static final String POINTER_SPEED = "pointer_speed"; + + /** @hide */ + public static final Validator POINTER_SPEED_VALIDATOR = + new SettingsValidators.InclusiveFloatRangeValidator(-7, 7); + + /** + * Whether lock-to-app will be triggered by long-press on recents. + * @hide + */ + public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled"; + + /** @hide */ + public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * I am the lolrus. + *

+ * Nonzero values indicate that the user has a bukkit. + * Backward-compatible with PrefGetPreference(prefAllowEasterEggs). + * @hide + */ + public static final String EGG_MODE = "egg_mode"; + + /** @hide */ + public static final Validator EGG_MODE_VALIDATOR = new Validator() { + @Override + public boolean validate(@Nullable String value) { + try { + return Long.parseLong(value) >= 0; + } catch (NumberFormatException e) { + return false; + } + } + }; + + /** + * Setting to determine whether or not to show the battery percentage in the status bar. + * 0 - Don't show percentage + * 1 - Show percentage + * @hide + */ + public static final String SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent"; + + /** @hide */ + private static final Validator SHOW_BATTERY_PERCENT_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * The time in ms to keep the button backlight on after pressing a button. + * A value of 0 will keep the buttons on for as long as the screen is on. + * @hide + */ + public static final String BUTTON_BACKLIGHT_TIMEOUT = "button_backlight_timeout"; + + /** @hide */ + public static final Validator BUTTON_BACKLIGHT_TIMEOUT_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR; + + /** + * Whether the button backlight is only lit when pressed (and not when screen is touched) + * The value is boolean (1 or 0). + */ + public static final String BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED = + "button_backlight_only_when_pressed"; + + /** @hide */ + public static final Validator BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * The button brightness to be used while the screen is on or after a button press, + * depending on the value of {@link BUTTON_BACKLIGHT_TIMEOUT}. + * Valid value range is between 0 and {@link PowerManager#getMaximumButtonBrightness()} + * @hide + */ + public static final String BUTTON_BRIGHTNESS = "button_brightness"; + + /** @hide */ + public static final Validator BUTTON_BRIGHTNESS_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR; + + /** + * Check the proximity sensor during wakeup + * @hide + */ + public static final String PROXIMITY_ON_WAKE = "proximity_on_wake"; + + /** + * @hide + */ + public static final String USE_OLD_MOBILETYPE = "use_old_mobiletype"; + + private static final Validator USE_OLD_MOBILETYPE_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** @hide */ + public static final Validator PROXIMITY_ON_WAKE_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * whether to enable or disable vibration on succesful fingerprint auth + * + * @hide + */ + public static final String FINGERPRINT_SUCCESS_VIB = "fingerprint_success_vib"; + + /** @hide */ + private static final Validator FINGERPRINT_SUCCESS_VIB_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * Defines the screen-off animation to display + * @hide + */ + public static final String SCREEN_OFF_ANIMATION = "screen_off_animation"; + + /** @hide */ + private static final Validator SCREEN_OFF_ANIMATION_VALIDATOR = + ANY_INTEGER_VALIDATOR; + + /** + * Whether to display music track title within the music qs tile + * @hide + */ + public static final String MUSIC_TILE_TITLE = "music_tile_title"; + + /** Whether to skip music track with volume rocker + * + * @hide + */ + public static final String VOLUME_BUTTON_MUSIC_CONTROL = "volume_button_music_control"; + + /** Whether to show ambient or lockscreen if AoD is disabled + * and we do a wake gesture like lift to wake or double tap + * + * @hide + */ + public static final String AMBIENT_WAKE_GESTURES = "ambient_wake_gestures"; + + /** Whether to pulse ambient on new music tracks + * + * @hide + */ + public static final String PULSE_ON_NEW_TRACKS = "pulse_on_new_tracks"; + + /** + * modify how the album art shows up on lockscreen + * 0 - normal + * 1 - grayscale + * 2 - accent tint + * 3 - blurry + * 4 - grayscale and blurry + * 5 - gradient blur (default) + * @hide + */ + public static final String LOCKSCREEN_ALBUM_ART_FILTER = "lockscreen_album_art_filter"; + + /** + * IMPORTANT: If you add a new public settings you also have to add it to + * PUBLIC_SETTINGS below. If the new setting is hidden you have to add + * it to PRIVATE_SETTINGS below. Also add a validator that can validate + * the setting value. See an example above. + */ + + /** + * Whether to show media art on lockscreen + * Boolean setting. 0 = off, 1 = on. + * @hide + */ + public static final String LOCKSCREEN_MEDIA_METADATA = "lockscreen_media_metadata"; + + /** @hide */ + public static final Validator LOCKSCREEN_MEDIA_METADATA_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * Ambient Display Visualizer + * + * @hide + */ + public static final String AMBIENT_VISUALIZER_ENABLED = "ambient_visualizer"; + + /** + * media artwork wallpaper blur level on lockscreen + * @hide + */ + public static final String LOCKSCREEN_MEDIA_BLUR = "lockscreen_media_blur"; + + private static final Validator LOCKSCREEN_MEDIA_BLUR_VALIDATOR = + ANY_INTEGER_VALIDATOR; + + /** + * @hide + */ + public static final String GLOBAL_ACTIONS_LIST = "global_actions_list"; + + /** + * Whether to display power in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_POWER = "global_actions_power"; + + /** + * Whether to display reboot in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_RESTART = "global_actions_restart"; + + /** + * Whether to display screenshot in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_SCREENSHOT = "global_actions_screenshot"; + + /** + * Whether the Screen record button should be shown in the power menu. + * @hide + */ + public static final String GLOBAL_ACTIONS_SCREENRECORD = "global_actions_screenrecord"; + + /** + * Whether to display settings in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_SETTINGS = "global_actions_settings"; + + /** + * Whether to display lock in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_LOCKDOWN = "global_actions_lockdown"; + + /** + * Whether to display airplane in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_AIRPLANE = "global_actions_airplane"; + + /** + * Whether to display the users option in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_USERS = "global_actions_users"; + + /** + * Whether to display the flashlight option in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_FLASHLIGHT = "global_actions_flashlight"; + + /** + * Whether to display the flashlight option in the power menu + * + * @hide + */ + public static final String GLOBAL_ACTIONS_EMERGENCY = "global_actions_emergency"; + + /** + * Whether to enable or disable vibration on fingerprint auth error + * @hide + */ + public static final String FP_ERROR_VIBRATE = "fp_error_vibrate"; + + + + /** + * Defines the global heads up notification snooze + * @hide + */ + public static final String HEADS_UP_NOTIFICATION_SNOOZE = "heads_up_notification_snooze"; + + /** @hide */ + private static final Validator HEADS_UP_NOTIFICATION_SNOOZE_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 1200000); + + /** + * Whether to show a floating CPU info over the screen + * @hide + */ + public static final String SHOW_CPU_OVERLAY = "show_cpu_overlay"; + + /** @hide */ + private static final Validator SHOW_CPU_OVERLAY_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * Heads up timeout configuration + * @hide + */ + public static final String HEADS_UP_TIMEOUT = "heads_up_timeout"; + + /** @hide */ + private static final Validator HEADS_UP_TIMEOUT_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 10000); + + /** + * Applications list where heasdup should't show + * + * @hide + */ + public static final String HEADS_UP_STOPLIST_VALUES = "heads_up_stoplist_values"; + + /** @hide */ + private static final Validator HEADS_UP_STOPLIST_VALUES_VALIDATOR = + ANY_STRING_VALIDATOR; + + /** + * Which applications to disable heads up notifications for + * + * @hide + */ + public static final String HEADS_UP_BLACKLIST_VALUES = "heads_up_blacklist_values"; + + /** @hide */ + private static final Validator HEADS_UP_BLACKLIST_VALUES_VALIDATOR = + ANY_STRING_VALIDATOR; + + /** + * @hide + */ + public static final String START_SCREEN_STATE_SERVICE = "start_screen_state_service"; + + + /** + * @hide + */ + public static final String SCREEN_STATE_TWOG = "screen_state_twog"; + + /** + * @hide + */ + public static final String SCREEN_STATE_GPS = "screen_state_gps"; + + /** + * @hide + */ + public static final String SCREEN_STATE_MOBILE_DATA = "screen_state_mobile_data"; + + /** + * @hide + */ + public static final String SCREEN_STATE_OFF_DELAY = "screen_state_off_delay"; + + /** + * @hide + */ + public static final String SCREEN_STATE_ON_DELAY = "screen_state_on_delay"; + + /** + * Whether to show the kill app button in notification guts + * + * @hide + */ + public static final String NOTIFICATION_GUTS_KILL_APP_BUTTON = + "notification_guts_kill_app_button"; + + /** @hide */ + private static final Validator NOTIFICATION_GUTS_KILL_APP_BUTTON_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * Wheter to show network traffic indicator in statusbar + * @hide + */ + public static final String NETWORK_TRAFFIC_STATE = "network_traffic_state"; + + /** + * Network traffic inactivity threshold (default is 1 kBs) + * @hide + */ + public static final String NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD = "network_traffic_autohide_threshold"; + + /** + * Whether to disable showing arrows in statusbar network traffic indicators + * @hide + */ + public static final String NETWORK_TRAFFIC_HIDEARROW = "network_traffic_hidearrow"; + + /** + * Number of qs columns on landscape orientation + * @hide + */ + public static final String QS_LAYOUT_COLUMNS_LANDSCAPE = "qs_layout_columns_landscape"; + + /** @hide */ + private static final Validator QS_LAYOUT_COLUMNS_LANDSCAPE_VALIDATOR = ANY_INTEGER_VALIDATOR; + + /** + * @hide + */ + public static final String QS_LAYOUT_COLUMNS = "qs_layout_columns"; + + /** @hide */ + private static final Validator QS_LAYOUT_COLUMNS_VALIDATOR = ANY_INTEGER_VALIDATOR; + + /** + * Whether to display qs tile titles in the qs panel + * @hide + */ + public static final String QS_TILE_TITLE_VISIBILITY = "qs_tile_title_visibility"; + + /** @hide */ + private static final Validator QS_TILE_TITLE_VISIBILITY_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * @hide + */ + public static final String QS_LAYOUT_ROWS = "qs_layout_rows"; + + /** @hide */ + private static final Validator QS_LAYOUT_ROWS_VALIDATOR = ANY_INTEGER_VALIDATOR; + + /** + * @hide + */ + public static final String QS_LAYOUT_ROWS_LANDSCAPE = "qs_layout_rows_landscape"; + + /** @hide */ + private static final Validator QS_LAYOUT_ROWS_LANDSCAPE_VALIDATOR = ANY_INTEGER_VALIDATOR; + + /** + * Whether the battery light should be enabled (if hardware supports it) + * The value is boolean (1 or 0). + * @hide + */ + public static final String BATTERY_LIGHT_ENABLED = "battery_light_enabled"; + + /** + * Whether to show battery light when DND mode is active + * @hide + */ + public static final String BATTERY_LIGHT_ALLOW_ON_DND = "battery_light_allow_on_dnd"; + + /** + * Whether to show blinking light when battery is low + * @hide + */ + public static final String BATTERY_LIGHT_LOW_BLINKING = "battery_light_low_blinking"; + + /** + * Low battery charging color + * @hide + */ + public static final String BATTERY_LIGHT_LOW_COLOR = "battery_light_low_color"; + + /** + * Medium battery charging color + * @hide + */ + public static final String BATTERY_LIGHT_MEDIUM_COLOR = "battery_light_medium_color"; + + /** + * Full battery charging color + * @hide + */ + public static final String BATTERY_LIGHT_FULL_COLOR = "battery_light_full_color"; + + /** + * Really full 100 battery charging color + * @hide + */ + public static final String BATTERY_LIGHT_REALLYFULL_COLOR = "battery_light_reallyfull_color"; + + /** + * @hide + */ + public static final String QS_QUICKBAR_COLUMNS = "qs_quickbar_columns"; + /** @hide */ + private static final Validator QS_QUICKBAR_COLUMNS_VALIDATOR = + ANY_INTEGER_VALIDATOR; + + /** + * Whether to show or hide the running services icon + * @hide + */ + public static final String QS_RUNNING_SERVICES_TOGGLE = "qs_running_services_toggle"; + + /** + * Double tap on lockscreen to sleep + * @hide + */ + public static final String DOUBLE_TAP_SLEEP_LOCKSCREEN = + "double_tap_sleep_lockscreen"; + + /** + * Enable statusbar double tap gesture on to put device to sleep + * @hide + */ + public static final String DOUBLE_TAP_SLEEP_GESTURE = "double_tap_sleep_gesture"; + + /** + * Whether to show Brightness Icon On Brightness Slider + * @hide + */ + public static final String QS_SHOW_BRIGHTNESS_ICON = "qs_show_brightness_icon"; + + /** + * Three Finger Gesture from Oppo + * @hide + */ + public static final String THREE_FINGER_GESTURE = "three_finger_gesture"; + + /** + * Whether to use partial screenshot when using volume keys + * @hide + */ + public static final String SCREENSHOT_TYPE = "screenshot_type"; + + /** + * enable custom lockscreen max notifications config + * @hide + */ + public static final String LOCK_SCREEN_CUSTOM_NOTIF = "lock_screen_custom_notif"; + /** @hide */ + private static final Validator LOCK_SCREEN_CUSTOM_NOTIF_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * custom lockscreen max notification config + * @hide + */ + public static final String LOCKSCREEN_MAX_NOTIF_CONFIG = "lockscreen_max_notif_config"; + /** @hide */ + private static final Validator LOCKSCREEN_MAX_NOTIF_CONFIG_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(1, 3); + + /** + * Whether to use the custom status bar header or not + * @hide + */ + public static final String STATUS_BAR_CUSTOM_HEADER = "status_bar_custom_header"; + + private static final Validator STATUS_BAR_CUSTOM_HEADER_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * Whether to apply a shadow on top of the header image + * value is the alpha value of the shadow image is 0 -> no shadow -> 255 black + * @hide + */ + public static final String STATUS_BAR_CUSTOM_HEADER_SHADOW = + "status_bar_custom_header_shadow"; + + private static final Validator STATUS_BAR_CUSTOM_HEADER_SHADOW_VALIDATOR = + ANY_INTEGER_VALIDATOR; + + /** + * header image package to use for daylight header - package name - null if default + * @hide + */ + public static final String STATUS_BAR_DAYLIGHT_HEADER_PACK = + "status_bar_daylight_header_pack"; + + private static final Validator STATUS_BAR_DAYLIGHT_HEADER_PACK_VALIDATOR = + ANY_STRING_VALIDATOR; + + /** + * Current active provider - available currently "static" "daylight" + * @hide + */ + public static final String STATUS_BAR_CUSTOM_HEADER_PROVIDER = + "status_bar_custom_header_provider"; + + private static final Validator STATUS_BAR_CUSTOM_HEADER_PROVIDER_VALIDATOR = + ANY_STRING_VALIDATOR; + + /** @hide */ + public static final String BACK_GESTURE_HEIGHT = "back_gesture_height"; + + /** @hide */ + private static final Validator BACK_GESTURE_HEIGHT_VALIDATOR = ANY_INTEGER_VALIDATOR; + + /** + * Manual override picture to use * @hide */ - @Deprecated - @UnsupportedAppUsage - public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND; + public static final String STATUS_BAR_CUSTOM_HEADER_IMAGE = + "status_bar_custom_header_image"; + + private static final Validator STATUS_BAR_CUSTOM_HEADER_IMAGE_VALIDATOR = + ANY_STRING_VALIDATOR; /** - * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND} - * instead * @hide */ - @Deprecated - @UnsupportedAppUsage - public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND; + public static final String STATUS_BAR_FILE_HEADER_IMAGE = + "status_bar_file_header_image"; + + private static final Validator STATUS_BAR_FILE_HEADER_IMAGE_VALIDATOR = + ANY_STRING_VALIDATOR; /** - * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND} - * instead * @hide */ - @Deprecated - @UnsupportedAppUsage - public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; + public static final String OMNIJAWS_WEATHER_ICON_PACK = "omnijaws_weather_icon_pack"; + + /** @hide */ + private static final Validator OMNIJAWS_WEATHER_ICON_PACK_VALIDATOR = + ANY_STRING_VALIDATOR; /** - * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} - * instead + * @hide + */ + public static final String OMNI_LOCKSCREEN_WEATHER_ENABLED = "lockscreen_weather_enabled"; + + /** @hide */ + private static final Validator OMNI_LOCKSCREEN_WEATHER_ENABLED_VALIDATOR = + BOOLEAN_VALIDATOR; + + + /** + * 0: OmniJaws Style + * 1: KeyguardSlice Style + * @hide + */ + public static final String LOCKSCREEN_WEATHER_STYLE = "lockscreen_weather_style"; + + /** @hide */ + private static final Validator LOCKSCREEN_WEATHER_STYLE_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 1); + + + /** + * Whether footer text shows the build type * @hide */ - @Deprecated - @UnsupportedAppUsage - public static final String LOCK_SOUND = Global.LOCK_SOUND; + public static final String FOOTER_TEXT_SHOW = "footer_text_show"; + /** @hide */ + private static final Validator FOOTER_TEXT_SHOW_VALIDATOR = + BOOLEAN_VALIDATOR; /** - * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} - * instead + * QS footer text * @hide */ - @Deprecated - @UnsupportedAppUsage - public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; + public static final String FOOTER_TEXT_STRING = "footer_text_string"; + /** @hide */ + private static final Validator FOOTER_TEXT_STRING_VALIDATOR = + ANY_STRING_VALIDATOR; /** - * Receive incoming SIP calls? - * 0 = no - * 1 = yes * @hide */ - public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; + public static final String LOCKSCREEN_WEATHER_SHOW_TEMP = "lockscreen_weather_show_temp"; /** @hide */ - public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = BOOLEAN_VALIDATOR; + private static final Validator LOCKSCREEN_WEATHER_SHOW_TEMP_VALIDATOR = BOOLEAN_VALIDATOR; /** - * Call Preference String. - * "SIP_ALWAYS" : Always use SIP with network access - * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address * @hide */ - public static final String SIP_CALL_OPTIONS = "sip_call_options"; + public static final String LOCKSCREEN_WEATHER_SHOW_CITY = "lockscreen_weather_show_city"; /** @hide */ - public static final Validator SIP_CALL_OPTIONS_VALIDATOR = - new SettingsValidators.DiscreteValueValidator( - new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"}); + private static final Validator LOCKSCREEN_WEATHER_SHOW_CITY_VALIDATOR = BOOLEAN_VALIDATOR; /** - * One of the sip call options: Always use SIP with network access. + * Whether to display 4G icon instead LTE * @hide */ - public static final String SIP_ALWAYS = "SIP_ALWAYS"; + public static final String SHOW_FOURG_ICON = "show_fourg_icon"; /** @hide */ - public static final Validator SIP_ALWAYS_VALIDATOR = BOOLEAN_VALIDATOR; + public static final String GESTURE_PILL_TOGGLE = "gesture_pill_toggle"; + + /** @hide */ + private static final Validator GESTURE_PILL_TOGGLE_VALIDATOR = BOOLEAN_VALIDATOR; /** - * One of the sip call options: Only if destination is a SIP address. + * Whether to show the battery info on the lockscreen while charging * @hide */ - public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; - - /** @hide */ - public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = BOOLEAN_VALIDATOR; + public static final String LOCKSCREEN_BATTERY_INFO = "lockscreen_battery_info"; /** - * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that - * the user should be prompted each time a call is made whether it should be placed using - * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with - * SIP_ADDRESS_ONLY. + * Enable/Disable screenshot sound * @hide */ - @Deprecated - public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; + public static final String SCREENSHOT_SOUND = "screenshot_sound"; - /** @hide */ - public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * Whether user can swap the order of the Alert Slider. + * * Whether user can invert the order of the Alert Slider. + * 0: Default + * 1: Inverted + * @hide + */ + public static final String ALERT_SLIDER_ORDER = "alert_slider_order"; /** - * Pointer speed setting. - * This is an integer value in a range between -7 and +7, so there are 15 possible values. - * -7 = slowest - * 0 = default speed - * +7 = fastest + * Preferred silent mode for Alert Slider.. + * 0: Alarms only. + * 1: Total silence * @hide */ - @UnsupportedAppUsage - public static final String POINTER_SPEED = "pointer_speed"; + public static final String ALERT_SLIDER_SILENT_MODE = "alert_slider_silent_mode"; - /** @hide */ - public static final Validator POINTER_SPEED_VALIDATOR = - new SettingsValidators.InclusiveFloatRangeValidator(-7, 7); /** - * Whether lock-to-app will be triggered by long-press on recents. + * some devices have a extra hw button e.g. n3 on the back on the + * fingerprint sensor. allow mapping button to key + * * @hide */ - public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled"; + public static final String CUSTOM_BUTTON_EXTRA_KEY_MAPPING = "button_extra_mapping"; /** @hide */ - public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; + private static final Validator CUSTOM_BUTTON_EXTRA_KEY_MAPPING_VALIDATOR = + ANY_STRING_VALIDATOR; /** - * I am the lolrus. - *

- * Nonzero values indicate that the user has a bukkit. - * Backward-compatible with PrefGetPreference(prefAllowEasterEggs). + * Enable proxi check for wake keys - must be implemented in a device + * KeyHandler * @hide */ - public static final String EGG_MODE = "egg_mode"; + public static final String CUSTOM_DEVICE_PROXI_CHECK_ENABLED = "device_proxi_check_enabled"; /** @hide */ - public static final Validator EGG_MODE_VALIDATOR = new Validator() { - @Override - public boolean validate(@Nullable String value) { - try { - return Long.parseLong(value) >= 0; - } catch (NumberFormatException e) { - return false; - } - } - }; + private static final Validator CUSTOM_DEVICE_PROXI_CHECK_ENABLED_VALIDATOR = + BOOLEAN_VALIDATOR; /** - * Setting to determine whether or not to show the battery percentage in the status bar. - * 0 - Don't show percentage - * 1 - Show percentage + * Enable Gesture Haptic feedback + * KeyHandler * @hide */ - public static final String SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent"; + public static final String CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED = + "device_gesture_feedback_enabled"; /** @hide */ - private static final Validator SHOW_BATTERY_PERCENT_VALIDATOR = BOOLEAN_VALIDATOR; + private static final Validator CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED_VALIDATOR = + BOOLEAN_VALIDATOR; /** - * IMPORTANT: If you add a new public settings you also have to add it to - * PUBLIC_SETTINGS below. If the new setting is hidden you have to add - * it to PRIVATE_SETTINGS below. Also add a validator that can validate - * the setting value. See an example above. + * @hide */ + public static final String CUSTOM_DEVICE_FEATURE_SETTINGS = "device_feature_settings"; + + /** @hide */ + private static final Validator CUSTOM_DEVICE_FEATURE_SETTINGS_VALIDATOR = + ANY_STRING_VALIDATOR; /** * Settings to backup. This is here so that it's in the same place as the settings @@ -4556,7 +5337,44 @@ public boolean validate(@Nullable String value) { HAPTIC_FEEDBACK_INTENSITY, DISPLAY_COLOR_MODE, ALARM_ALERT, + USE_OLD_MOBILETYPE, NOTIFICATION_LIGHT_PULSE, + FINGERPRINT_SUCCESS_VIB, + SCREEN_OFF_ANIMATION, + LOCKSCREEN_MEDIA_METADATA, + LOCKSCREEN_MEDIA_BLUR, + HEADS_UP_NOTIFICATION_SNOOZE, + HEADS_UP_TIMEOUT, + HEADS_UP_STOPLIST_VALUES, + HEADS_UP_BLACKLIST_VALUES, + NOTIFICATION_GUTS_KILL_APP_BUTTON, + QS_LAYOUT_COLUMNS_LANDSCAPE, + QS_LAYOUT_COLUMNS, + QS_TILE_TITLE_VISIBILITY, + QS_LAYOUT_ROWS, + QS_LAYOUT_ROWS_LANDSCAPE, + QS_QUICKBAR_COLUMNS, + LOCK_SCREEN_CUSTOM_NOTIF, + LOCKSCREEN_MAX_NOTIF_CONFIG, + STATUS_BAR_CUSTOM_HEADER, + STATUS_BAR_CUSTOM_HEADER_SHADOW, + STATUS_BAR_DAYLIGHT_HEADER_PACK, + STATUS_BAR_CUSTOM_HEADER_PROVIDER, + STATUS_BAR_CUSTOM_HEADER_IMAGE, + STATUS_BAR_FILE_HEADER_IMAGE, + OMNIJAWS_WEATHER_ICON_PACK, + OMNI_LOCKSCREEN_WEATHER_ENABLED, + LOCKSCREEN_WEATHER_STYLE, + FOOTER_TEXT_SHOW, + FOOTER_TEXT_STRING, + LOCKSCREEN_WEATHER_SHOW_TEMP, + LOCKSCREEN_WEATHER_SHOW_CITY, + GESTURE_PILL_TOGGLE, + BACK_GESTURE_HEIGHT, + CUSTOM_BUTTON_EXTRA_KEY_MAPPING, + CUSTOM_DEVICE_PROXI_CHECK_ENABLED, + CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED, + CUSTOM_DEVICE_FEATURE_SETTINGS, }; /** @@ -4571,6 +5389,35 @@ public boolean validate(@Nullable String value) { public static final String[] LEGACY_RESTORE_SETTINGS = { }; + /** + * Wheter to play notification sound and vibration if screen is on + * @hide + */ + public static final String NOTIFICATION_SOUND_VIB_SCREEN_ON = "notification_sound_vib_screen_on"; + + /** @hide */ + private static final Validator NOTIFICATION_SOUND_VIB_SCREEN_ON_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * Display cutout + * @hide + */ + public static final String DISPLAY_CUTOUT_HIDDEN = "display_cutout_hidden"; + + /** @hide */ + private static final Validator DISPLAY_CUTOUT_HIDDEN_VALIDATOR = new + SettingsValidators.InclusiveIntegerRangeValidator(0, 1); + + /** + * Force full screen for devices with cutout + * @hide + */ + public static final String FORCE_FULLSCREEN_CUTOUT_APPS = "force_full_screen_cutout_apps"; + + /** @hide */ + private static final Validator FORCE_FULLSCREEN_CUTOUT_APPS_VALIDATOR = ANY_STRING_VALIDATOR; + /** * These are all public system settings * @@ -4676,6 +5523,59 @@ public boolean validate(@Nullable String value) { PRIVATE_SETTINGS.add(EGG_MODE); PRIVATE_SETTINGS.add(SHOW_BATTERY_PERCENT); PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE); + PRIVATE_SETTINGS.add(BUTTON_BACKLIGHT_TIMEOUT); + PRIVATE_SETTINGS.add(BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED); + PRIVATE_SETTINGS.add(BUTTON_BRIGHTNESS); + PRIVATE_SETTINGS.add(PROXIMITY_ON_WAKE); + PRIVATE_SETTINGS.add(FINGERPRINT_SUCCESS_VIB); + PRIVATE_SETTINGS.add(SCREEN_OFF_ANIMATION); + PRIVATE_SETTINGS.add(NOTIFICATION_SOUND_VIB_SCREEN_ON); + PRIVATE_SETTINGS.add(DISPLAY_CUTOUT_HIDDEN); + PRIVATE_SETTINGS.add(FORCE_FULLSCREEN_CUTOUT_APPS); + PRIVATE_SETTINGS.add(LOCKSCREEN_MEDIA_METADATA); + PRIVATE_SETTINGS.add(LOCKSCREEN_MEDIA_BLUR); + PRIVATE_SETTINGS.add(SHOW_CPU_OVERLAY); + PRIVATE_SETTINGS.add(HEADS_UP_NOTIFICATION_SNOOZE); + PRIVATE_SETTINGS.add(HEADS_UP_TIMEOUT); + PRIVATE_SETTINGS.add(HEADS_UP_STOPLIST_VALUES); + PRIVATE_SETTINGS.add(HEADS_UP_BLACKLIST_VALUES); + PRIVATE_SETTINGS.add(NOTIFICATION_GUTS_KILL_APP_BUTTON); + PRIVATE_SETTINGS.add(START_SCREEN_STATE_SERVICE); + PRIVATE_SETTINGS.add(SCREEN_STATE_TWOG); + PRIVATE_SETTINGS.add(SCREEN_STATE_GPS); + PRIVATE_SETTINGS.add(SCREEN_STATE_MOBILE_DATA); + PRIVATE_SETTINGS.add(SCREEN_STATE_OFF_DELAY); + PRIVATE_SETTINGS.add(SCREEN_STATE_ON_DELAY); + PRIVATE_SETTINGS.add(QS_LAYOUT_COLUMNS_LANDSCAPE); + PRIVATE_SETTINGS.add(QS_LAYOUT_COLUMNS); + PRIVATE_SETTINGS.add(QS_TILE_TITLE_VISIBILITY); + PRIVATE_SETTINGS.add(QS_LAYOUT_ROWS); + PRIVATE_SETTINGS.add(QS_LAYOUT_ROWS_LANDSCAPE); + PRIVATE_SETTINGS.add(QS_QUICKBAR_COLUMNS); + PRIVATE_SETTINGS.add(CUSTOM_BUTTON_EXTRA_KEY_MAPPING); + PRIVATE_SETTINGS.add(CUSTOM_DEVICE_PROXI_CHECK_ENABLED); + PRIVATE_SETTINGS.add(CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED); + PRIVATE_SETTINGS.add(CUSTOM_DEVICE_FEATURE_SETTINGS); + PRIVATE_SETTINGS.add(DOUBLE_TAP_SLEEP_LOCKSCREEN); + PRIVATE_SETTINGS.add(DOUBLE_TAP_SLEEP_GESTURE); + PRIVATE_SETTINGS.add(LOCK_SCREEN_CUSTOM_NOTIF); + PRIVATE_SETTINGS.add(LOCKSCREEN_MAX_NOTIF_CONFIG); + PRIVATE_SETTINGS.add(STATUS_BAR_CUSTOM_HEADER); + PRIVATE_SETTINGS.add(STATUS_BAR_CUSTOM_HEADER_SHADOW); + PRIVATE_SETTINGS.add(STATUS_BAR_DAYLIGHT_HEADER_PACK); + PRIVATE_SETTINGS.add(STATUS_BAR_CUSTOM_HEADER_PROVIDER); + PRIVATE_SETTINGS.add(STATUS_BAR_CUSTOM_HEADER_IMAGE); + PRIVATE_SETTINGS.add(STATUS_BAR_FILE_HEADER_IMAGE); + PRIVATE_SETTINGS.add(OMNIJAWS_WEATHER_ICON_PACK); + PRIVATE_SETTINGS.add(OMNI_LOCKSCREEN_WEATHER_ENABLED); + PRIVATE_SETTINGS.add(LOCKSCREEN_WEATHER_STYLE); + PRIVATE_SETTINGS.add(FOOTER_TEXT_SHOW); + PRIVATE_SETTINGS.add(FOOTER_TEXT_STRING); + PRIVATE_SETTINGS.add(LOCKSCREEN_WEATHER_SHOW_TEMP); + PRIVATE_SETTINGS.add(LOCKSCREEN_WEATHER_SHOW_CITY); + PRIVATE_SETTINGS.add(USE_OLD_MOBILETYPE); + PRIVATE_SETTINGS.add(GESTURE_PILL_TOGGLE); + PRIVATE_SETTINGS.add(BACK_GESTURE_HEIGHT); } /** @@ -4769,6 +5669,58 @@ public boolean validate(@Nullable String value) { VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR); VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR); + VALIDATORS.put(BUTTON_BACKLIGHT_TIMEOUT, BUTTON_BACKLIGHT_TIMEOUT_VALIDATOR); + VALIDATORS.put(BUTTON_BRIGHTNESS, BUTTON_BRIGHTNESS_VALIDATOR); + VALIDATORS.put(PROXIMITY_ON_WAKE, PROXIMITY_ON_WAKE_VALIDATOR); + VALIDATORS.put(BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED, BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED_VALIDATOR); + VALIDATORS.put(FINGERPRINT_SUCCESS_VIB, FINGERPRINT_SUCCESS_VIB_VALIDATOR); + VALIDATORS.put(SCREEN_OFF_ANIMATION, SCREEN_OFF_ANIMATION_VALIDATOR); + VALIDATORS.put(NOTIFICATION_SOUND_VIB_SCREEN_ON, + NOTIFICATION_SOUND_VIB_SCREEN_ON_VALIDATOR); + VALIDATORS.put(DISPLAY_CUTOUT_HIDDEN, DISPLAY_CUTOUT_HIDDEN_VALIDATOR); + VALIDATORS.put(FORCE_FULLSCREEN_CUTOUT_APPS, FORCE_FULLSCREEN_CUTOUT_APPS_VALIDATOR); + VALIDATORS.put(LOCKSCREEN_MEDIA_METADATA, LOCKSCREEN_MEDIA_METADATA_VALIDATOR); + VALIDATORS.put(LOCKSCREEN_MEDIA_BLUR, LOCKSCREEN_MEDIA_BLUR_VALIDATOR); + VALIDATORS.put(SHOW_CPU_OVERLAY, SHOW_CPU_OVERLAY_VALIDATOR); + VALIDATORS.put(HEADS_UP_NOTIFICATION_SNOOZE,HEADS_UP_NOTIFICATION_SNOOZE_VALIDATOR); + VALIDATORS.put(HEADS_UP_TIMEOUT,HEADS_UP_TIMEOUT_VALIDATOR); + VALIDATORS.put(HEADS_UP_STOPLIST_VALUES, HEADS_UP_STOPLIST_VALUES_VALIDATOR); + VALIDATORS.put(HEADS_UP_BLACKLIST_VALUES, HEADS_UP_BLACKLIST_VALUES_VALIDATOR); + VALIDATORS.put(NOTIFICATION_GUTS_KILL_APP_BUTTON, NOTIFICATION_GUTS_KILL_APP_BUTTON_VALIDATOR); + VALIDATORS.put(QS_LAYOUT_COLUMNS_LANDSCAPE, QS_LAYOUT_COLUMNS_LANDSCAPE_VALIDATOR); + VALIDATORS.put(QS_LAYOUT_COLUMNS, QS_LAYOUT_COLUMNS_VALIDATOR); + VALIDATORS.put(QS_TILE_TITLE_VISIBILITY, QS_TILE_TITLE_VISIBILITY_VALIDATOR); + VALIDATORS.put(QS_LAYOUT_ROWS, QS_LAYOUT_ROWS_VALIDATOR); + VALIDATORS.put(QS_LAYOUT_ROWS_LANDSCAPE, QS_LAYOUT_ROWS_LANDSCAPE_VALIDATOR); + VALIDATORS.put(QS_QUICKBAR_COLUMNS, QS_QUICKBAR_COLUMNS_VALIDATOR); + VALIDATORS.put(LOCK_SCREEN_CUSTOM_NOTIF, LOCK_SCREEN_CUSTOM_NOTIF_VALIDATOR); + VALIDATORS.put(LOCKSCREEN_MAX_NOTIF_CONFIG, LOCKSCREEN_MAX_NOTIF_CONFIG_VALIDATOR); + VALIDATORS.put(STATUS_BAR_CUSTOM_HEADER, + STATUS_BAR_CUSTOM_HEADER_VALIDATOR); + VALIDATORS.put(STATUS_BAR_CUSTOM_HEADER_SHADOW, + STATUS_BAR_CUSTOM_HEADER_SHADOW_VALIDATOR); + VALIDATORS.put(STATUS_BAR_DAYLIGHT_HEADER_PACK, + STATUS_BAR_DAYLIGHT_HEADER_PACK_VALIDATOR); + VALIDATORS.put(STATUS_BAR_CUSTOM_HEADER_PROVIDER, + STATUS_BAR_CUSTOM_HEADER_PROVIDER_VALIDATOR); + VALIDATORS.put(STATUS_BAR_CUSTOM_HEADER_IMAGE, + STATUS_BAR_CUSTOM_HEADER_IMAGE_VALIDATOR); + VALIDATORS.put(STATUS_BAR_FILE_HEADER_IMAGE, + STATUS_BAR_FILE_HEADER_IMAGE_VALIDATOR); + VALIDATORS.put(OMNIJAWS_WEATHER_ICON_PACK,OMNIJAWS_WEATHER_ICON_PACK_VALIDATOR); + VALIDATORS.put(OMNI_LOCKSCREEN_WEATHER_ENABLED,OMNI_LOCKSCREEN_WEATHER_ENABLED_VALIDATOR); + VALIDATORS.put(LOCKSCREEN_WEATHER_STYLE,LOCKSCREEN_WEATHER_STYLE_VALIDATOR); + VALIDATORS.put(FOOTER_TEXT_SHOW, FOOTER_TEXT_SHOW_VALIDATOR); + VALIDATORS.put(FOOTER_TEXT_STRING, FOOTER_TEXT_STRING_VALIDATOR); + VALIDATORS.put(LOCKSCREEN_WEATHER_SHOW_TEMP, LOCKSCREEN_WEATHER_SHOW_TEMP_VALIDATOR); + VALIDATORS.put(LOCKSCREEN_WEATHER_SHOW_CITY, LOCKSCREEN_WEATHER_SHOW_CITY_VALIDATOR); + VALIDATORS.put(USE_OLD_MOBILETYPE, USE_OLD_MOBILETYPE_VALIDATOR); + VALIDATORS.put(GESTURE_PILL_TOGGLE, GESTURE_PILL_TOGGLE_VALIDATOR); + VALIDATORS.put(BACK_GESTURE_HEIGHT, BACK_GESTURE_HEIGHT_VALIDATOR); + VALIDATORS.put(CUSTOM_BUTTON_EXTRA_KEY_MAPPING, CUSTOM_BUTTON_EXTRA_KEY_MAPPING_VALIDATOR); + VALIDATORS.put(CUSTOM_DEVICE_PROXI_CHECK_ENABLED, CUSTOM_DEVICE_PROXI_CHECK_ENABLED_VALIDATOR); + VALIDATORS.put(CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED, CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED_VALIDATOR); + VALIDATORS.put(CUSTOM_DEVICE_FEATURE_SETTINGS, CUSTOM_DEVICE_FEATURE_SETTINGS_VALIDATOR); } /** @@ -8280,6 +9232,21 @@ public boolean validate(@Nullable String value) { private static final Validator CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * Whether the torch launch gesture to double tap or long press the power button when the + * screen is off should be enabled. + * + * 0: disabled + * 1: double tap power for torch + * 2: long tap power for torch + * @hide + */ + public static final String TORCH_POWER_BUTTON_GESTURE = + "torch_power_button_gesture"; + + private static final Validator TORCH_POWER_BUTTON_GESTURE_VALIDATOR = + NON_NEGATIVE_INTEGER_VALIDATOR; + /** * Whether the camera double twist gesture to flip between front and back mode should be * enabled. @@ -8583,6 +9550,12 @@ public boolean validate(@Nullable String value) { */ public static final int VR_DISPLAY_MODE_OFF = 1; + /** Whether to vibrate when quick settings tile is pressed. + * + * @hide + */ + public static final String QUICK_SETTINGS_TILES_VIBRATE = "quick_settings_vibrate"; + /** * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least * once. @@ -8675,6 +9648,14 @@ public boolean validate(@Nullable String value) { private static final Validator SYSTEM_NAVIGATION_KEYS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * Wheter to dismiss notifications on fingerprint left and right swipe action + * @hide + */ + public static final String FP_SWIPE_TO_DISMISS_NOTIFICATIONS = "fp_swipe_to_dismiss_notifications"; + + private static final Validator FP_SWIPE_TO_DISMISS_NOTIFICATIONS_VALIDATOR = BOOLEAN_VALIDATOR; + /** * Holds comma separated list of ordering of QS tiles. * @hide @@ -8985,6 +9966,88 @@ public boolean validate(@Nullable String value) { private static final Validator AWARE_LOCK_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * Show or hide clock + * 0 - hide + * 1 - show (default) + * @hide + */ + public static final String STATUS_BAR_CLOCK = "status_bar_clock"; + + /** + * @hide + */ + public static final Validator STATUS_BAR_CLOCK_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 1); + + /** + * AM/PM Style for clock options + * 0 - No AM/PM (default) + * 1 - Small AM/PM + * 2 - Normal AM/PM + * @hide + */ + public static final String STATUSBAR_CLOCK_AM_PM_STYLE = "statusbar_clock_am_pm_style"; + + /** + * @hide + */ + public static final Validator STATUSBAR_CLOCK_AM_PM_STYLE_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 2); + + /** + * Shows custom date before clock time + * 0 - No Date + * 1 - Small Date + * 2 - Normal Date + * @hide + */ + public static final String STATUSBAR_CLOCK_DATE_DISPLAY = "statusbar_clock_date_display"; + + /** + * @hide + */ + public static final Validator STATUSBAR_CLOCK_DATE_DISPLAY_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 2); + + /** + * Sets the date string style + * 0 - Regular style + * 1 - Lowercase + * 2 - Uppercase + * @hide + */ + public static final String STATUSBAR_CLOCK_DATE_STYLE = "statusbar_clock_date_style"; + + /** + * @hide + */ + public static final Validator STATUSBAR_CLOCK_DATE_STYLE_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 2); + + /** + * Stores the java DateFormat string for the date + * @hide + */ + public static final String STATUSBAR_CLOCK_DATE_FORMAT = "statusbar_clock_date_format"; + + /** + * @hide + */ + public static final Validator STATUSBAR_CLOCK_DATE_FORMAT_VALIDATOR = ANY_STRING_VALIDATOR; + + /** + * Position of date + * 0 - Left of clock + * 1 - Right of clock + * @hide + */ + public static final String STATUSBAR_CLOCK_DATE_POSITION = "statusbar_clock_date_position"; + + /** @hide */ + public static final Validator STATUSBAR_CLOCK_DATE_POSITION_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 1); + /** * Controls whether tap gesture is enabled. * @hide @@ -8993,6 +10056,32 @@ public boolean validate(@Nullable String value) { private static final Validator TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * Lockscreen Visualizer + * + * @hide + */ + public static final String LOCKSCREEN_VISUALIZER_ENABLED = "lockscreen_visualizer"; + + /** + * + * @hide + */ + public static final String GLOBAL_ACTION_DNAA = "global_action_dnaa"; + + /** + * @hide + */ + public static final String ADVANCED_REBOOT = "advanced_reboot"; + + private static final Validator ADVANCED_REBOOT_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * Whether to show the brightness slider in quick settings panel + * @hide + */ + public static final String QS_SHOW_BRIGHTNESS_SLIDER = "qs_show_brightness_slider"; + /** * This are the settings to be backed up. * @@ -9068,6 +10157,7 @@ public boolean validate(@Nullable String value) { SYNC_PARENT_SOUNDS, CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, + TORCH_POWER_BUTTON_GESTURE, SYSTEM_NAVIGATION_KEYS_ENABLED, QS_TILES, DOZE_ENABLED, @@ -9129,7 +10219,8 @@ public boolean validate(@Nullable String value) { GLOBAL_ACTIONS_PANEL_ENABLED, AWARE_LOCK_ENABLED, AWARE_TAP_PAUSE_GESTURE_COUNT, - AWARE_TAP_PAUSE_TOUCH_COUNT + AWARE_TAP_PAUSE_TOUCH_COUNT, + ADVANCED_REBOOT }; /** @@ -9237,8 +10328,12 @@ public boolean validate(@Nullable String value) { CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED_VALIDATOR); VALIDATORS.put(CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED_VALIDATOR); + VALIDATORS.put(TORCH_POWER_BUTTON_GESTURE, + TORCH_POWER_BUTTON_GESTURE_VALIDATOR); VALIDATORS.put(SYSTEM_NAVIGATION_KEYS_ENABLED, SYSTEM_NAVIGATION_KEYS_ENABLED_VALIDATOR); + VALIDATORS.put(FP_SWIPE_TO_DISMISS_NOTIFICATIONS, + FP_SWIPE_TO_DISMISS_NOTIFICATIONS_VALIDATOR); VALIDATORS.put(QS_TILES, QS_TILES_VALIDATOR); VALIDATORS.put(DOZE_ENABLED, DOZE_ENABLED_VALIDATOR); VALIDATORS.put(DOZE_ALWAYS_ON, DOZE_ALWAYS_ON_VALIDATOR); @@ -9327,6 +10422,7 @@ public boolean validate(@Nullable String value) { VALIDATORS.put(AWARE_TAP_PAUSE_GESTURE_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(AWARE_TAP_PAUSE_TOUCH_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR); VALIDATORS.put(TAP_GESTURE, TAP_GESTURE_VALIDATOR); + VALIDATORS.put(ADVANCED_REBOOT, ADVANCED_REBOOT_VALIDATOR); } /** @@ -12559,6 +13655,30 @@ public boolean validate(@Nullable String value) { public static final String ADB_ALLOWED_CONNECTION_TIME = "adb_allowed_connection_time"; + /** + * Whether or not to use aggressive device idle constants and ignore motion. + * Type: int (0 for false, 1 for true) + * Default: 0 + * @hide + */ + public static final String AGGRESSIVE_IDLE_ENABLED = "aggressive_idle_enabled"; + + /** + * Whether or not to use aggressive app idle constants. + * Type: int (0 for false, 1 for true) + * Default: 0 + * @hide + */ + public static final String AGGRESSIVE_STANDBY_ENABLED = "aggressive_standby_enabled"; + + /** + * Flag to automatically enable Aggressive Idle and Standby with battery saver. + * Type: int (0 for false, 1 for true) + * Default: 0 + * @hide + */ + public static final String AGGRESSIVE_BATTERY_SAVER = "aggressive_battery_saver"; + /** * Get the key that retrieves a bluetooth headset's priority. * @hide @@ -13894,6 +15014,20 @@ public boolean validate(@Nullable String value) { private static final Validator POWER_BUTTON_VERY_LONG_PRESS_VALIDATOR = new SettingsValidators.InclusiveIntegerRangeValidator(0, 1); + /** + * Whether applications can fake a signature. + * 1 = permit apps to fake signature + * 0 = disable this feature + * @hide + */ + public static final String ALLOW_SIGNATURE_FAKE = "allow_signature_fake"; + + /** + * This preference enables showing the power menu on LockScreen. + * @hide + */ + public static final String LOCKSCREEN_ENABLE_POWER_MENU = "lockscreen_enable_power_menu"; + /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. diff --git a/core/java/android/service/dreams/DreamManagerInternal.java b/core/java/android/service/dreams/DreamManagerInternal.java index ff7cef9d945a..c750b5e5976a 100644 --- a/core/java/android/service/dreams/DreamManagerInternal.java +++ b/core/java/android/service/dreams/DreamManagerInternal.java @@ -42,4 +42,9 @@ public abstract class DreamManagerInternal { * Called by the power manager to determine whether a dream is running. */ public abstract boolean isDreaming(); + + /** + * Called by the power manager to determine whether the dream has gone to doze mode. + */ + public abstract boolean isDozing(); } diff --git a/core/java/android/service/dreams/IDreamManager.aidl b/core/java/android/service/dreams/IDreamManager.aidl index d3f2a70029f7..2774c3953676 100644 --- a/core/java/android/service/dreams/IDreamManager.aidl +++ b/core/java/android/service/dreams/IDreamManager.aidl @@ -34,6 +34,7 @@ interface IDreamManager { void testDream(in ComponentName componentName); @UnsupportedAppUsage boolean isDreaming(); + boolean isDozing(); void finishSelf(in IBinder token, boolean immediate); void startDozing(in IBinder token, int screenState, int screenBrightness); void stopDozing(in IBinder token); diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java index 93bcdbffd133..d458a100c70d 100644 --- a/core/java/android/service/notification/ZenModeConfig.java +++ b/core/java/android/service/notification/ZenModeConfig.java @@ -388,7 +388,7 @@ private static boolean sameCondition(ZenRule rule) { } private static int[] generateMinuteBuckets() { - final int maxHrs = 12; + final int maxHrs = 24; final int[] buckets = new int[maxHrs + 3]; buckets[0] = 15; buckets[1] = 30; diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index d645e3f746d7..7210ae1f33c1 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -1449,7 +1449,7 @@ public void executeMessage(Message message) { return; } case MSG_UPDATE_SURFACE: - mEngine.updateSurface(true, false, false); + mEngine.updateSurface(true, false, true/*false*/); break; case MSG_VISIBILITY_CHANGED: if (DEBUG) Log.v(TAG, "Visibility change in " + mEngine diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java index da566c934ef7..5734f2260c22 100644 --- a/core/java/android/util/NtpTrustedTime.java +++ b/core/java/android/util/NtpTrustedTime.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (C) 2018 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,17 +64,14 @@ public static synchronized NtpTrustedTime getInstance(Context context) { final Resources res = context.getResources(); final ContentResolver resolver = context.getContentResolver(); - final String defaultServer = res.getString( - com.android.internal.R.string.config_ntpServer); final long defaultTimeout = res.getInteger( com.android.internal.R.integer.config_ntpTimeout); - final String secureServer = Settings.Global.getString( + final String server = Settings.Global.getString( resolver, Settings.Global.NTP_SERVER); final long timeout = Settings.Global.getLong( resolver, Settings.Global.NTP_TIMEOUT, defaultTimeout); - final String server = secureServer != null ? secureServer : defaultServer; sSingleton = new NtpTrustedTime(server, timeout); sContext = context; } @@ -96,10 +94,8 @@ public boolean forceRefresh() { } public boolean forceRefresh(Network network) { - if (TextUtils.isEmpty(mServer)) { - // missing server, so no trusted time available - return false; - } + final String realServer = TextUtils.isEmpty(mServer) ? sContext.getResources().getString( + com.android.internal.R.string.config_ntpServer) : mServer; // We can't do this at initialization time: ConnectivityService might not be running yet. synchronized (this) { @@ -117,7 +113,7 @@ public boolean forceRefresh(Network network) { if (LOGD) Log.d(TAG, "forceRefresh() from cache miss"); final SntpClient client = new SntpClient(); - if (client.requestTime(mServer, (int) mTimeout, network)) { + if (client.requestTime(realServer, (int) mTimeout, network)) { mHasCache = true; mCachedNtpTime = client.getNtpTime(); mCachedNtpElapsedRealtime = client.getNtpTimeReference(); diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index b347a78a8780..ce39d9d46c86 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -21,6 +21,7 @@ import com.android.internal.policy.IKeyguardDismissCallback; import com.android.internal.policy.IShortcutService; import android.app.IAssistDataReceiver; +import android.content.Intent; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.graphics.Bitmap; @@ -313,6 +314,11 @@ interface IWindowManager */ oneway void setForceShowSystemBars(boolean show); + /** + * Send some ActionHandler commands to WindowManager. + */ + void sendCustomAction(in Intent intent); + /** * Called by System UI to notify of changes to the visibility of Recents. */ diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 87dd5b47c448..a767accf2877 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -1933,6 +1933,7 @@ public static final boolean isSystemKey(int keyCode) { /** @hide */ public static final boolean isWakeKey(int keyCode) { switch (keyCode) { + case KeyEvent.KEYCODE_HOME: case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_MENU: case KeyEvent.KEYCODE_WAKEUP: diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 57a01a32e1b8..dfc61575acff 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -5647,6 +5647,11 @@ private int processKeyEvent(QueuedInputEvent q) { private int processPointerEvent(QueuedInputEvent q) { final MotionEvent event = (MotionEvent)q.mEvent; + if (event.getPointerCount() == 3 && isSwipeToScreenshotGestureActive()) { + event.setAction(MotionEvent.ACTION_CANCEL); + Log.d("teste", "canceling motionEvent because of threeGesture detecting"); + } + mAttachInfo.mUnbufferedDispatchRequested = false; mAttachInfo.mHandlingPointerEvent = true; boolean handled = mView.dispatchPointerEvent(event); @@ -9195,4 +9200,13 @@ boolean preViewDispatch(KeyEvent event) { return false; } } + + private boolean isSwipeToScreenshotGestureActive() { + try { + return ActivityManager.getService().isSwipeToScreenshotGestureActive(); + } catch (RemoteException e) { + Log.e("teste", "isSwipeToScreenshotGestureActive exception", e); + return false; + } + } } diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 73e0e4b2eb8b..fd7fe550defc 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -1122,6 +1122,11 @@ public void clearFlags(int flags) { setFlags(0, flags); } + /** @hide */ + public void clearPrivateFlags(int flags) { + setPrivateFlags(0, flags); + } + /** * Set the flags of the window, as per the * {@link WindowManager.LayoutParams WindowManager.LayoutParams} @@ -1149,6 +1154,10 @@ public void setFlags(int flags, int mask) { } private void setPrivateFlags(int flags, int mask) { + if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY) != 0) { + mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", + "No permission to prevent power key"); + } final WindowManager.LayoutParams attrs = getAttributes(); attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask); dispatchWindowAttributesChanged(attrs); diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 36fea589da99..4798d19e9461 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1831,6 +1831,12 @@ public static boolean isSystemAlertWindowType(int type) { */ public static final int PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC = 0x01000000; + /** + * Window flag: Overrides default power key behavior + * @hide + */ + public static final int PRIVATE_FLAG_PREVENT_POWER_KEY = 0x20000000; + /** * An internal annotation for flags that can be specified to {@link #softInputMode}. * diff --git a/core/java/android/widget/Toast.java b/core/java/android/widget/Toast.java index d037337d4546..116820c59ba1 100644 --- a/core/java/android/widget/Toast.java +++ b/core/java/android/widget/Toast.java @@ -24,9 +24,11 @@ import android.app.INotificationManager; import android.app.ITransientNotification; import android.content.Context; +import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.PixelFormat; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.os.IBinder; @@ -391,7 +393,7 @@ private static class TN extends ITransientNotification.Stub { params.height = WindowManager.LayoutParams.WRAP_CONTENT; params.width = WindowManager.LayoutParams.WRAP_CONTENT; params.format = PixelFormat.TRANSLUCENT; - params.windowAnimations = com.android.internal.R.style.Animation_Toast; + params.windowAnimations = com.android.internal.R.style.Animation_Toast_Material; params.type = WindowManager.LayoutParams.TYPE_TOAST; params.setTitle("Toast"); params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON @@ -481,6 +483,19 @@ public void handleShow(IBinder windowToken) { if (context == null) { context = mView.getContext(); } + + ImageView appIcon = (ImageView) mView.findViewById(android.R.id.icon); + if (appIcon != null) { + PackageManager pm = context.getPackageManager(); + Drawable icon = null; + try { + icon = pm.getApplicationIcon(packageName); + } catch (PackageManager.NameNotFoundException e) { + // nothing to do + } + appIcon.setImageDrawable(icon); + } + mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); // We can resolve the Gravity here by using the Locale for getting // the layout direction diff --git a/core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java b/core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java index d9a78dadba41..91b166d5338c 100644 --- a/core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java +++ b/core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java @@ -120,6 +120,13 @@ public final class SystemUiDeviceConfigFlags { */ public static final String HASH_SALT_MAX_DAYS = "hash_salt_max_days"; + // Flag related to Privacy Indicators + + /** + * Whether the Permissions Hub is showing. + */ + public static final String PROPERTY_PERMISSIONS_HUB_ENABLED = "permissions_hub_enabled"; + // Flags related to Assistant /** diff --git a/core/java/com/android/internal/os/AlternativeDeviceKeyHandler.java b/core/java/com/android/internal/os/AlternativeDeviceKeyHandler.java new file mode 100644 index 000000000000..648fdb555dcf --- /dev/null +++ b/core/java/com/android/internal/os/AlternativeDeviceKeyHandler.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 The CyanogenMod Project + * Copyright (C) 2015-2018 The OmniROM 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.os; + +import android.content.Intent; +import android.hardware.SensorEvent; +import android.view.KeyEvent; + +public interface AlternativeDeviceKeyHandler { + + /** + * Invoked when an unknown key was detected by the system, letting the device handle + * this special keys prior to pass the key to the active app. + * + * @param event The key event to be handled + * @return If the event is consume + */ + public boolean handleKeyEvent(KeyEvent event); + + /** + * Invoked when an unknown key was detected by the system, + * this should NOT handle the key just return if it WOULD be handled + * + * @param event The key event to be handled + * @return If the event will be consumed + */ + public boolean canHandleKeyEvent(KeyEvent event); + + /** + * Special key event that should be treated as + * a camera launch event + * + * @param event The key event to be handled + * @return If the event is a camera launch event + */ + public boolean isCameraLaunchEvent(KeyEvent event); + + /** + * Special key event that should be treated as + * a wake event + * + * @param event The key event to be handled + * @return If the event is a wake event + */ + public boolean isWakeEvent(KeyEvent event); + + /** + * Return false if this event should be ignored + * + * @param event The key event to be handled + * @return If the event should be ignored + */ + public boolean isDisabledKeyEvent(KeyEvent event); + + /** + * Return an Intent that should be launched for that KeyEvent + * + * @param event The key event to be handled + * @return an Intent or null + */ + public Intent isActivityLaunchEvent(KeyEvent event); +} diff --git a/core/java/com/android/internal/os/DeviceKeyHandler.java b/core/java/com/android/internal/os/DeviceKeyHandler.java new file mode 100644 index 000000000000..8902337f3ebb --- /dev/null +++ b/core/java/com/android/internal/os/DeviceKeyHandler.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2012 The CyanogenMod 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.os; + +import android.view.KeyEvent; + +public interface DeviceKeyHandler { + + /** + * Invoked when an unknown key was detected by the system, letting the device handle + * this special keys prior to pass the key to the active app. + * + * @param event The key event to be handled + * @return null if event is consumed, KeyEvent to be handled otherwise + */ + public KeyEvent handleKeyEvent(KeyEvent event); +} diff --git a/core/java/com/android/internal/os/KernelCpuUidTimeReader.java b/core/java/com/android/internal/os/KernelCpuUidTimeReader.java index e6d044f4722b..8dec0507d9b1 100644 --- a/core/java/com/android/internal/os/KernelCpuUidTimeReader.java +++ b/core/java/com/android/internal/os/KernelCpuUidTimeReader.java @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; +import android.os.Build; import android.os.StrictMode; import android.os.SystemClock; import android.util.IntArray; @@ -431,7 +432,11 @@ void readDeltaImpl(@Nullable Callback cb) { CharBuffer buf; while ((buf = iter.nextLine()) != null) { if (asLongs(buf, mBuffer) != mBuffer.length) { - Slog.wtf(mTag, "Invalid line: " + buf.toString()); + if (Build.IS_ENG) { + Slog.wtf(mTag, "Invalid line: " + buf.toString()); + } else { + Slog.w(mTag, "Invalid line: " + buf.toString()); + } continue; } final int uid = (int) mBuffer[0]; diff --git a/core/java/com/android/internal/os/PowerProfile.java b/core/java/com/android/internal/os/PowerProfile.java index 8338d78af3a1..6280306afdb2 100644 --- a/core/java/com/android/internal/os/PowerProfile.java +++ b/core/java/com/android/internal/os/PowerProfile.java @@ -21,6 +21,8 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.XmlResourceParser; +import android.os.SystemProperties; +import android.util.Slog; import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.VisibleForTesting; @@ -39,6 +41,7 @@ * [hidden] */ public class PowerProfile { + private static final String TAG = "PowerProfile"; /* * POWER_CPU_SUSPEND: Power consumption when CPU is in power collapse mode. @@ -259,8 +262,7 @@ public PowerProfile(Context context, boolean forTest) { } private void readPowerValuesFromXml(Context context, boolean forTest) { - final int id = forTest ? com.android.internal.R.xml.power_profile_test : - com.android.internal.R.xml.power_profile; + int id = getPowerProfileResId(context, forTest); final Resources resources = context.getResources(); XmlResourceParser parser = resources.getXml(id); boolean parsingArray = false; @@ -421,6 +423,30 @@ public double getAveragePowerForCpuCore(int cluster, int step) { return 0; } + private int getPowerProfileResId(final Context context, boolean forTest) { + if (forTest) { + return com.android.internal.R.xml.power_profile_test; + } + + /* + * If ro.power_profile.override is set, use it to override the default. + * This is used for devices, which need to dynamically define the power profile. + */ + String powerProfileOverride = SystemProperties.get("ro.power_profile.override"); + if (!powerProfileOverride.isEmpty()) { + int id = context.getResources().getIdentifier(powerProfileOverride, "xml", "android"); + if (id > 0) { + Slog.i(TAG, "getPowerProfileResId: using power profile \"" + + powerProfileOverride + "\""); + return id; + } + Slog.e(TAG, "getPowerProfileResId: could not retrieve power profile \"" + + powerProfileOverride + "\", using default instead"); + } + + return com.android.internal.R.xml.power_profile; + } + /** * Returns the number of memory bandwidth buckets defined in power_profile.xml, or a * default value if the subsystem has no recorded value. diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index daa57e05aef6..7f13c976e8a7 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -31,6 +31,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER; +import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS; import android.annotation.NonNull; @@ -2504,6 +2505,16 @@ protected ViewGroup generateLayout(DecorView decor) { params.layoutInDisplayCutoutMode = mode; } + if (ActivityManager.isSystemReady()) { + try { + String packageName = context.getBasePackageName(); + if (ActivityManager.getService().shouldForceCutoutFullscreen(packageName)){ + params.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + } + } catch (RemoteException e) { + } + } + if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { if (a.getBoolean( diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index c715577cb7d2..0ec1979c5517 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -149,7 +149,7 @@ oneway interface IStatusBar void showPinningEnterExitToast(boolean entering); void showPinningEscapeToast(); - void showShutdownUi(boolean isReboot, String reason); + void showShutdownUi(boolean isReboot, String reason, boolean rebootCustom); // Used to show the dialog when BiometricService starts authentication void showBiometricDialog(in Bundle bundle, IBiometricServiceReceiverInternal receiver, int type, @@ -162,6 +162,9 @@ oneway interface IStatusBar void onBiometricError(String error); // Used to hide the biometric dialog when the AuthenticationClient is stopped void hideBiometricDialog(); + // Used to show or hide in display fingerprint view + void showInDisplayFingerprintView(); + void hideInDisplayFingerprintView(); /** * Notifies System UI that the display is ready to show system decorations. @@ -172,4 +175,9 @@ oneway interface IStatusBar * Notifies System UI whether the recents animation is running or not. */ void onRecentsAnimationStateChanged(boolean running); + + //Omni + void toggleCameraFlash(); + void toggleCameraFlashState(boolean enable); + } diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index 598c3917bf95..094dcfaefa79 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -85,7 +85,7 @@ interface IStatusBarService * These methods are needed for global actions control which the UI is shown in sysui. */ void shutdown(); - void reboot(boolean safeMode); + void reboot(boolean safeMode, String reason); void addTile(in ComponentName tile); void remTile(in ComponentName tile); @@ -110,4 +110,13 @@ interface IStatusBarService void onBiometricError(String error); // Used to hide the biometric dialog when the AuthenticationClient is stopped void hideBiometricDialog(); + // Used to show or hide in display fingerprint view + void showInDisplayFingerprintView(); + void hideInDisplayFingerprintView(); + + /** + * Extra features functions + */ + void toggleCameraFlash(); + void toggleCameraFlashState(boolean enable); } diff --git a/core/java/com/android/internal/util/DogbinException.java b/core/java/com/android/internal/util/DogbinException.java new file mode 100644 index 000000000000..719e111de4fb --- /dev/null +++ b/core/java/com/android/internal/util/DogbinException.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2018 Potato Open Sauce 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.util; + +public class DogbinException extends Exception { + + private static final long serialVersionUID = 666L; + + public DogbinException(String message) { + super(message); + } +} \ No newline at end of file diff --git a/core/java/com/android/internal/util/DogbinUtils.java b/core/java/com/android/internal/util/DogbinUtils.java new file mode 100644 index 000000000000..49b5816e5884 --- /dev/null +++ b/core/java/com/android/internal/util/DogbinUtils.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2018 Potato Open Sauce 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.util; + +import android.util.JsonReader; +import android.os.Handler; +import android.os.HandlerThread; + + +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.URL; + +import javax.net.ssl.HttpsURLConnection; + +/** + * Helper functions for uploading to del.dog + */ +public final class DogbinUtils { + private static final String TAG = "DogbinUtils"; + private static final String BASE_URL = "https://del.dog"; + private static final String API_URL = String.format("%s/documents", BASE_URL); + private static Handler handler; + + private DogbinUtils() { + } + + /** + * Uploads {@code content} to dogbin + * + * @param content the content to upload to dogbin + * @param callback the callback to call on success / failure + */ + public static void upload(String content, UploadResultCallback callback) { + getHandler().post(new Runnable() { + @Override + public void run() { + try { + HttpsURLConnection urlConnection = (HttpsURLConnection) new URL(API_URL).openConnection(); + try { + urlConnection.setRequestProperty("Accept-Charset", "UTF-8"); + urlConnection.setDoOutput(true); + + try (OutputStream output = urlConnection.getOutputStream()) { + output.write(content.getBytes("UTF-8")); + } + String key = ""; + try (JsonReader reader = new JsonReader( + new InputStreamReader(urlConnection.getInputStream(), "UTF-8"))) { + reader.beginObject(); + while (reader.hasNext()) { + String name = reader.nextName(); + if (name.equals("key")) { + key = reader.nextString(); + break; + } else { + reader.skipValue(); + } + } + reader.endObject(); + } + if (!key.isEmpty()) { + callback.onSuccess(getUrl(key)); + } else { + String msg = "Failed to upload to dogbin: No key retrieved"; + callback.onFail(msg, new DogbinException(msg)); + } + } finally { + urlConnection.disconnect(); + } + } catch (Exception e) { + callback.onFail("Failed to upload to dogbin", e); + } + } + }); + } + + /** + * Get the view URL from a key + */ + private static String getUrl(String key) { + return String.format("%s/%s", BASE_URL, key); + } + + private static Handler getHandler() { + if (handler == null) { + HandlerThread handlerThread = new HandlerThread("dogbinThread"); + if (!handlerThread.isAlive()) + handlerThread.start(); + handler = new Handler(handlerThread.getLooper()); + } + return handler; + } + + public interface UploadResultCallback { + void onSuccess(String url); + + void onFail(String message, Exception e); + } +} \ No newline at end of file diff --git a/core/java/com/android/internal/util/ScreenshotHelper.java b/core/java/com/android/internal/util/ScreenshotHelper.java index d24d78c6f3da..68f32e5f4b0f 100644 --- a/core/java/com/android/internal/util/ScreenshotHelper.java +++ b/core/java/com/android/internal/util/ScreenshotHelper.java @@ -1,5 +1,7 @@ package com.android.internal.util; +import static android.view.WindowManager.TAKE_SCREENSHOT_SELECTED_REGION; + import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ComponentName; @@ -172,7 +174,9 @@ public void onServiceDisconnected(ComponentName name) { Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, UserHandle.CURRENT)) { mScreenshotConnection = conn; - handler.postDelayed(mScreenshotTimeout, timeoutMs); + if (screenshotType != TAKE_SCREENSHOT_SELECTED_REGION) { + handler.postDelayed(mScreenshotTimeout, timeoutMs); + } } } } diff --git a/core/java/com/android/internal/util/UserContentObserver.java b/core/java/com/android/internal/util/UserContentObserver.java new file mode 100644 index 000000000000..99c0008673e0 --- /dev/null +++ b/core/java/com/android/internal/util/UserContentObserver.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2014 The CyanogenMod 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.util; + +import android.app.ActivityManagerNative; +import android.app.IUserSwitchObserver; +import android.database.ContentObserver; +import android.net.Uri; +import android.os.Handler; +import android.os.IRemoteCallback; +import android.os.RemoteException; +import android.util.Log; + +/** + * Simple extension of ContentObserver that also listens for user switch events to call update + */ +public abstract class UserContentObserver extends ContentObserver { + private static final String TAG = "UserContentObserver"; + + private Runnable mUpdateRunnable; + + private IUserSwitchObserver mUserSwitchObserver = new IUserSwitchObserver.Stub() { + @Override + public void onUserSwitching(int newUserId, IRemoteCallback reply) { + } + @Override + public void onUserSwitchComplete(int newUserId) throws RemoteException { + mHandler.post(mUpdateRunnable); + } + @Override + public void onForegroundProfileSwitch(int newProfileId) { + } + @Override + public void onLockedBootComplete(int val) { + } + }; + + private Handler mHandler; + + public UserContentObserver(Handler handler) { + super(handler); + mHandler = handler; + mUpdateRunnable = new Runnable() { + @Override + public void run() { + update(); + } + }; + } + + protected void observe() { + try { + ActivityManagerNative.getDefault().registerUserSwitchObserver(mUserSwitchObserver, TAG); + } catch (RemoteException e) { + Log.w(TAG, "Unable to register user switch observer!", e); + } + } + + protected void unobserve() { + try { + mHandler.removeCallbacks(mUpdateRunnable); + ActivityManagerNative.getDefault().unregisterUserSwitchObserver(mUserSwitchObserver); + } catch (RemoteException e) { + Log.w(TAG, "Unable to unregister user switch observer!", e); + } + } + + protected abstract void update(); + + @Override + public void onChange(boolean selfChange) { + update(); + } + + @Override + public void onChange(boolean selfChange, Uri uri) { + update(); + } +} + diff --git a/core/java/com/android/internal/util/UserIcons.java b/core/java/com/android/internal/util/UserIcons.java index bfe43237da58..d921290efd1a 100644 --- a/core/java/com/android/internal/util/UserIcons.java +++ b/core/java/com/android/internal/util/UserIcons.java @@ -73,7 +73,7 @@ public static Drawable getDefaultUserIcon(Resources resources, int userId, boole colorResId = USER_ICON_COLORS[userId % USER_ICON_COLORS.length]; } Drawable icon = resources.getDrawable(R.drawable.ic_account_circle, null).mutate(); - icon.setColorFilter(resources.getColor(colorResId, null), Mode.SRC_IN); + icon.setColorFilter(resources.getColor(colorResId, null), Mode.SRC_ATOP); icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); return icon; } diff --git a/core/java/com/android/internal/util/bootleggers/Action.java b/core/java/com/android/internal/util/bootleggers/Action.java new file mode 100644 index 000000000000..df83a5ccd5ba --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/Action.java @@ -0,0 +1,307 @@ +/* +* Copyright (C) 2014 SlimRoms 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.util.bootleggers; + +import android.app.Activity; +import android.app.ActivityManagerNative; +import android.app.SearchManager; +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; +import android.hardware.camera2.CameraManager; +import android.hardware.camera2.CameraCharacteristics; +import android.hardware.camera2.CameraAccessException; +import android.hardware.input.InputManager; +import android.media.AudioManager; +import android.media.session.MediaSessionLegacyHelper; +import android.media.ToneGenerator; +import android.net.Uri; +import android.os.PowerManager; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.SystemClock; +import android.os.UserHandle; +import android.os.Vibrator; +import android.provider.Settings; +import android.provider.MediaStore; +import android.util.Log; +import android.view.InputDevice; +import android.view.KeyCharacterMap; +import android.view.KeyEvent; +import android.view.WindowManagerGlobal; + +import java.net.URISyntaxException; + +public class Action { + + private static final int MSG_INJECT_KEY_DOWN = 1066; + private static final int MSG_INJECT_KEY_UP = 1067; + + private static boolean sTorchEnabled = false; + + public static void processAction(Context context, String action, boolean isLongpress) { + processActionWithOptions(context, action, isLongpress, true); + } + + public static void processActionWithOptions(Context context, + String action, boolean isLongpress, boolean collapseShade) { + + if (action == null || action.equals(ActionConstants.ACTION_NULL)) { + return; + } + + boolean isKeyguardShowing = false; + try { + isKeyguardShowing = + WindowManagerGlobal.getWindowManagerService().isKeyguardLocked(); + } catch (RemoteException e) { + Log.w("Action", "Error getting window manager service", e); + } + + // process the actions + if (action.equals(ActionConstants.ACTION_HOME)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_HOME, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_BACK)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_BACK, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_SEARCH)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_SEARCH, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_MENU) + || action.equals(ActionConstants.ACTION_MENU_BIG)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_MENU, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_IME_NAVIGATION_LEFT)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_DPAD_LEFT, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_IME_NAVIGATION_RIGHT)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_DPAD_RIGHT, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_IME_NAVIGATION_UP)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_DPAD_UP, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_IME_NAVIGATION_DOWN)) { + triggerVirtualKeypress(KeyEvent.KEYCODE_DPAD_DOWN, isLongpress); + return; + } else if (action.equals(ActionConstants.ACTION_TORCH)) { + try { + CameraManager cameraManager = (CameraManager) + context.getSystemService(Context.CAMERA_SERVICE); + for (final String cameraId : cameraManager.getCameraIdList()) { + CameraCharacteristics characteristics = + cameraManager.getCameraCharacteristics(cameraId); + Boolean flashAvailable = characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE); + int orient = characteristics.get(CameraCharacteristics.LENS_FACING); + if (flashAvailable != null && flashAvailable && orient == CameraCharacteristics.LENS_FACING_BACK) { + cameraManager.setTorchMode(cameraId, !sTorchEnabled); + sTorchEnabled = !sTorchEnabled; + break; + } + } + } catch (CameraAccessException e) { + } + return; + } else if (action.equals(ActionConstants.ACTION_POWER)) { + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + pm.goToSleep(SystemClock.uptimeMillis()); + return; + } else if (action.equals(ActionConstants.ACTION_IME)) { + if (isKeyguardShowing) { + return; + } + context.sendBroadcastAsUser( + new Intent("android.settings.SHOW_INPUT_METHOD_PICKER"), + new UserHandle(UserHandle.USER_CURRENT)); + return; + } else if (action.equals(ActionConstants.ACTION_VOICE_SEARCH)) { + // launch the search activity + Intent intent = new Intent(Intent.ACTION_SEARCH_LONG_PRESS); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + try { + // TODO: This only stops the factory-installed search manager. + // Need to formalize an API to handle others + SearchManager searchManager = + (SearchManager) context.getSystemService(Context.SEARCH_SERVICE); + if (searchManager != null) { + searchManager.stopSearch(); + } + startActivity(context, intent); + } catch (ActivityNotFoundException e) { + Log.e("gzospActions:", "No activity to handle assist long press action.", e); + } + return; + } else if (action.equals(ActionConstants.ACTION_VIB)) { + AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + if(am != null && ActivityManagerNative.isSystemReady()) { + if(am.getRingerMode() != AudioManager.RINGER_MODE_VIBRATE) { + am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); + Vibrator vib = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + if(vib != null){ + vib.vibrate(50); + } + }else{ + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); + ToneGenerator tg = new ToneGenerator( + AudioManager.STREAM_NOTIFICATION, + (int)(ToneGenerator.MAX_VOLUME * 0.85)); + if(tg != null){ + tg.startTone(ToneGenerator.TONE_PROP_BEEP); + } + } + } + return; + } else if (action.equals(ActionConstants.ACTION_SILENT)) { + AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + if (am != null && ActivityManagerNative.isSystemReady()) { + if (am.getRingerMode() != AudioManager.RINGER_MODE_SILENT) { + am.setRingerMode(AudioManager.RINGER_MODE_SILENT); + } else { + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); + ToneGenerator tg = new ToneGenerator( + AudioManager.STREAM_NOTIFICATION, + (int)(ToneGenerator.MAX_VOLUME * 0.85)); + if (tg != null) { + tg.startTone(ToneGenerator.TONE_PROP_BEEP); + } + } + } + return; + } else if (action.equals(ActionConstants.ACTION_VIB_SILENT)) { + AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + if (am != null && ActivityManagerNative.isSystemReady()) { + if (am.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) { + am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); + Vibrator vib = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + if (vib != null) { + vib.vibrate(50); + } + } else if (am.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) { + am.setRingerMode(AudioManager.RINGER_MODE_SILENT); + } else { + am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); + ToneGenerator tg = new ToneGenerator( + AudioManager.STREAM_NOTIFICATION, + (int)(ToneGenerator.MAX_VOLUME * 0.85)); + if (tg != null) { + tg.startTone(ToneGenerator.TONE_PROP_BEEP); + } + } + } + return; + } else if (action.equals(ActionConstants.ACTION_CAMERA)) { + // ToDo: Send for secure keyguard secure camera intent. + // We need to add support for it first. + Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA, null); + startActivity(context, intent); + return; + } else if (action.equals(ActionConstants.ACTION_MEDIA_PREVIOUS)) { + dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_PREVIOUS, context); + return; + } else if (action.equals(ActionConstants.ACTION_MEDIA_NEXT)) { + dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_NEXT, context); + return; + } else if (action.equals(ActionConstants.ACTION_MEDIA_PLAY_PAUSE)) { + dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, context); + return; + } else if (action.equals(ActionConstants.ACTION_WAKE_DEVICE)) { + PowerManager powerManager = + (PowerManager) context.getSystemService(Context.POWER_SERVICE); + if (!powerManager.isScreenOn()) { + powerManager.wakeUp(SystemClock.uptimeMillis()); + } + return; + } else { + // we must have a custom uri + Intent intent = null; + try { + intent = Intent.parseUri(action, 0); + } catch (URISyntaxException e) { + Log.e("gzospActions:", "URISyntaxException: [" + action + "]"); + return; + } + startActivity(context, intent); + return; + } + + } + + public static boolean isActionKeyEvent(String action) { + if (action.equals(ActionConstants.ACTION_HOME) + || action.equals(ActionConstants.ACTION_BACK) + || action.equals(ActionConstants.ACTION_SEARCH) + || action.equals(ActionConstants.ACTION_MENU) + || action.equals(ActionConstants.ACTION_MENU_BIG) + || action.equals(ActionConstants.ACTION_NULL)) { + return true; + } + return false; + } + + private static void startActivity(Context context, Intent intent) { + if (intent == null) { + return; + } + intent.addFlags( + Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_SINGLE_TOP + | Intent.FLAG_ACTIVITY_CLEAR_TOP); + context.startActivityAsUser(intent, + new UserHandle(UserHandle.USER_CURRENT)); + } + + private static void dispatchMediaKeyWithWakeLock(int keycode, Context context) { + if (ActivityManagerNative.isSystemReady()) { + KeyEvent event = new KeyEvent(SystemClock.uptimeMillis(), + SystemClock.uptimeMillis(), KeyEvent.ACTION_DOWN, keycode, 0); + MediaSessionLegacyHelper.getHelper(context).sendMediaButtonEvent(event, true); + event = KeyEvent.changeAction(event, KeyEvent.ACTION_UP); + MediaSessionLegacyHelper.getHelper(context).sendMediaButtonEvent(event, true); + } + } + + public static void triggerVirtualKeypress(final int keyCode, boolean longpress) { + InputManager im = InputManager.getInstance(); + long now = SystemClock.uptimeMillis(); + int downflags = 0; + int upflags = 0; + if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT + || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT + || keyCode == KeyEvent.KEYCODE_DPAD_UP + || keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { + downflags = upflags = KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE; + } else { + downflags = upflags = KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY; + } + if (longpress) { + downflags |= KeyEvent.FLAG_LONG_PRESS; + } + + final KeyEvent downEvent = new KeyEvent(now, now, KeyEvent.ACTION_DOWN, + keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, + downflags, + InputDevice.SOURCE_KEYBOARD); + im.injectInputEvent(downEvent, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); + + final KeyEvent upEvent = new KeyEvent(now, now, KeyEvent.ACTION_UP, + keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, + upflags, + InputDevice.SOURCE_KEYBOARD); + im.injectInputEvent(upEvent, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/ActionConfig.java b/core/java/com/android/internal/util/bootleggers/ActionConfig.java new file mode 100644 index 000000000000..45c25ceda59e --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/ActionConfig.java @@ -0,0 +1,81 @@ +/* +* Copyright (C) 2014 SlimRoms 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.util.bootleggers; + +public class ActionConfig { + + private String mClickAction; + private String mClickActionDescription; + private String mLongpressAction; + private String mLongpressActionDescription; + private String mIconUri; + + public ActionConfig(String clickAction, String clickActionDescription, + String longpressAction, String longpressActionDescription, String iconUri) { + mClickAction = clickAction; + mClickActionDescription = clickActionDescription; + mLongpressAction = longpressAction; + mLongpressActionDescription = longpressActionDescription; + mIconUri = iconUri; + } + + @Override + public String toString() { + return mClickActionDescription; + } + + public String getClickAction() { + return mClickAction; + } + + public String getClickActionDescription() { + return mClickActionDescription; + } + + public String getLongpressAction() { + return mLongpressAction; + } + + public String getLongpressActionDescription() { + return mLongpressActionDescription; + } + + public String getIcon() { + return mIconUri; + } + + public void setClickAction(String action) { + mClickAction = action; + } + + public void setClickActionDescription(String description) { + mClickActionDescription = description; + } + + public void setLongpressAction(String action) { + mLongpressAction = action; + } + + public void setLongpressActionDescription(String description) { + mLongpressActionDescription = description; + } + + public void setIcon(String iconUri) { + mIconUri = iconUri; + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/ActionConstants.java b/core/java/com/android/internal/util/bootleggers/ActionConstants.java new file mode 100644 index 000000000000..206794c4e1ba --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/ActionConstants.java @@ -0,0 +1,102 @@ +/* +* Copyright (C) 2013 SlimRoms 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.util.bootleggers; + +public class ActionConstants { + + // key must fit with the values arrays from Settings to use + // SlimActions.java actions + public static final String ACTION_HOME = "**home**"; + public static final String ACTION_BACK = "**back**"; + public static final String ACTION_SEARCH = "**search**"; + public static final String ACTION_VOICE_SEARCH = "**voice_search**"; + public static final String ACTION_MENU = "**menu**"; + public static final String ACTION_MENU_BIG = "**menu_big**"; + public static final String ACTION_POWER = "**power**"; + public static final String ACTION_NOTIFICATIONS = "**notifications**"; + public static final String ACTION_RECENTS = "**recents**"; + public static final String ACTION_SCREENSHOT = "**screenshot**"; + public static final String ACTION_IME = "**ime**"; + public static final String ACTION_LAST_APP = "**lastapp**"; + public static final String ACTION_KILL = "**kill**"; + public static final String ACTION_ASSIST = "**assist**"; + public static final String ACTION_VIB = "**ring_vib**"; + public static final String ACTION_SILENT = "**ring_silent**"; + public static final String ACTION_VIB_SILENT = "**ring_vib_silent**"; + public static final String ACTION_POWER_MENU = "**power_menu**"; + public static final String ACTION_TORCH = "**torch**"; + public static final String ACTION_EXPANDED_DESKTOP = "**expanded_desktop**"; + public static final String ACTION_THEME_SWITCH = "**theme_switch**"; + public static final String ACTION_KEYGUARD_SEARCH = "**keyguard_search**"; + public static final String ACTION_PIE = "**pie**"; + public static final String ACTION_NAVBAR = "**nav_bar**"; + public static final String ACTION_IME_NAVIGATION_LEFT = "**ime_nav_left**"; + public static final String ACTION_IME_NAVIGATION_RIGHT = "**ime_nav_right**"; + public static final String ACTION_IME_NAVIGATION_UP = "**ime_nav_up**"; + public static final String ACTION_IME_NAVIGATION_DOWN = "**ime_nav_down**"; + public static final String ACTION_CAMERA = "**camera**"; + public static final String ACTION_MEDIA_PREVIOUS = "**media_previous**"; + public static final String ACTION_MEDIA_NEXT = "**media_next**"; + public static final String ACTION_MEDIA_PLAY_PAUSE = "**media_play_pause**"; + public static final String ACTION_WAKE_DEVICE = "**wake_device**"; + + // no action + public static final String ACTION_NULL = "**null**"; + + // this shorcut constant is only used to identify if the user + // selected in settings a custom app...after it is choosed intent uri + // is saved in the ButtonConfig object + public static final String ACTION_APP = "**app**"; + + public static final String ICON_EMPTY = "empty"; + public static final String SYSTEM_ICON_IDENTIFIER = "system_shortcut="; + public static final String ACTION_DELIMITER = "|"; + + public static final String NAVIGATION_CONFIG_DEFAULT = + ACTION_BACK + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY + ACTION_DELIMITER + + ACTION_HOME + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY + ACTION_DELIMITER + + ACTION_RECENTS + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY; + + public static final String NAV_RING_CONFIG_DEFAULT = + ACTION_ASSIST + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY; + + public static final String PIE_SECOND_LAYER_CONFIG_DEFAULT = + ACTION_POWER_MENU + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY + ACTION_DELIMITER + + ACTION_NOTIFICATIONS + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY + ACTION_DELIMITER + + ACTION_SEARCH + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY + ACTION_DELIMITER + + ACTION_SCREENSHOT + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY + ACTION_DELIMITER + + ACTION_IME + ACTION_DELIMITER + + ACTION_NULL + ACTION_DELIMITER + + ICON_EMPTY; + +} diff --git a/core/java/com/android/internal/util/bootleggers/ActionHelper.java b/core/java/com/android/internal/util/bootleggers/ActionHelper.java new file mode 100644 index 000000000000..4d3844548e86 --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/ActionHelper.java @@ -0,0 +1,162 @@ +/* +* Copyright (C) 2014 SlimRoms 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.util.bootleggers; + +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.provider.Settings; +import android.os.UserHandle; +import android.util.Log; + +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URISyntaxException; +import java.util.ArrayList; + +public class ActionHelper { + + private static final String SYSTEMUI_METADATA_NAME = "com.android.systemui"; + + // General methods to retrieve the correct icon for the respective action. + public static Drawable getButtonIconImage(Context context, + String clickAction, String customIcon) { + int resId = -1; + Drawable d = null; + PackageManager pm = context.getPackageManager(); + if (pm == null) { + return null; + } + + Resources systemUiResources; + try { + systemUiResources = pm.getResourcesForApplication(SYSTEMUI_METADATA_NAME); + } catch (Exception e) { + Log.e("ButtonsHelper:", "can't access systemui resources",e); + return null; + } + + if (!clickAction.startsWith("**")) { + try { + String extraIconPath = clickAction.replaceAll(".*?hasExtraIcon=", ""); + if (extraIconPath != null && !extraIconPath.isEmpty()) { + File f = new File(Uri.parse(extraIconPath).getPath()); + if (f.exists()) { + d = new BitmapDrawable(context.getResources(), + f.getAbsolutePath()); + } + } + if (d == null) { + d = pm.getActivityIcon(Intent.parseUri(clickAction, 0)); + } + } catch (NameNotFoundException e) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_null", null, null); + if (resId > 0) { + d = systemUiResources.getDrawable(resId); + return d; + } + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + + if (customIcon != null && customIcon.startsWith(ActionConstants.SYSTEM_ICON_IDENTIFIER)) { + resId = systemUiResources.getIdentifier(customIcon.substring( + ActionConstants.SYSTEM_ICON_IDENTIFIER.length()), "drawable", "android"); + if (resId > 0) { + return systemUiResources.getDrawable(resId); + } + } else if (customIcon != null && !customIcon.equals(ActionConstants.ICON_EMPTY)) { + File f = new File(Uri.parse(customIcon).getPath()); + if (f.exists()) { + return new BitmapDrawable(context.getResources(), + ImageHelper.getRoundedCornerBitmap( + new BitmapDrawable(context.getResources(), + f.getAbsolutePath()).getBitmap())); + } else { + Log.e("ActionHelper:", "can't access custom icon image"); + return null; + } + } else if (clickAction.startsWith("**")) { + resId = getActionSystemIcon(systemUiResources, clickAction); + + if (resId > 0) { + return systemUiResources.getDrawable(resId); + } + } + return d; + } + + private static int getActionSystemIcon(Resources systemUiResources, String clickAction) { + int resId = -1; + + // ToDo: Add the resources to SystemUI. + if (clickAction.equals(ActionConstants.ACTION_HOME)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_home", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_BACK)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_back", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_RECENTS)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_recent", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_SEARCH) + || clickAction.equals(ActionConstants.ACTION_ASSIST)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_search", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_KEYGUARD_SEARCH)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_search_light", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_MENU)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_menu", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_MENU_BIG)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_menu_big", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_IME)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_ime_switcher", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_POWER)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_power", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_POWER_MENU)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_power_menu", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_VIB)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_vib", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_SILENT)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_silent", null, null); + } else if (clickAction.equals(ActionConstants.ACTION_VIB_SILENT)) { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_ring_vib_silent", null, null); + } else { + resId = systemUiResources.getIdentifier( + SYSTEMUI_METADATA_NAME + ":drawable/ic_sysbar_null", null, null); + } + return resId; + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/AppHelper.java b/core/java/com/android/internal/util/bootleggers/AppHelper.java new file mode 100644 index 000000000000..b7c7615ddb43 --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/AppHelper.java @@ -0,0 +1,138 @@ +/* +* Copyright (C) 2013 gzosp 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.util.bootleggers; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.res.Resources; +import android.util.Log; + +import java.net.URISyntaxException; + +public class AppHelper { + + private static final String SETTINGS_METADATA_NAME = "com.android.settings"; + + public static String getProperSummary(Context context, PackageManager pm, + Resources settingsResources, String action, String values, String entries) { + + if (pm == null || settingsResources == null || action == null) { + return context.getResources().getString( + com.android.internal.R.string.error_message_title); + } + + if (values != null && entries != null) { + int resIdEntries = -1; + int resIdValues = -1; + + resIdEntries = settingsResources.getIdentifier( + SETTINGS_METADATA_NAME + ":array/" + entries, null, null); + + resIdValues = settingsResources.getIdentifier( + SETTINGS_METADATA_NAME + ":array/" + values, null, null); + + if (resIdEntries > 0 && resIdValues > 0) { + try { + String[] entriesArray = settingsResources.getStringArray(resIdEntries); + String[] valuesArray = settingsResources.getStringArray(resIdValues); + for (int i = 0; i < valuesArray.length; i++) { + if (action.equals(valuesArray[i])) { + return entriesArray[i]; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + return getFriendlyNameForUri(context, pm, action); + } + + public static String getFriendlyActivityName(Context context, + PackageManager pm, Intent intent, boolean labelOnly) { + ActivityInfo ai = intent.resolveActivityInfo(pm, PackageManager.GET_ACTIVITIES); + String friendlyName = null; + + if (ai != null) { + friendlyName = ai.loadLabel(pm).toString(); + if (friendlyName == null && !labelOnly) { + friendlyName = ai.name; + } + } + + if (friendlyName == null || friendlyName.startsWith("#Intent;")) { + return context.getResources().getString( + com.android.internal.R.string.error_message_title); + } + return friendlyName != null || labelOnly ? friendlyName : intent.toUri(0); + } + + public static String getFriendlyShortcutName( + Context context, PackageManager pm, Intent intent) { + String activityName = getFriendlyActivityName(context, pm, intent, true); + String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); + + if (activityName == null || activityName.startsWith("#Intent;")) { + return context.getResources().getString( + com.android.internal.R.string.error_message_title); + } + if (activityName != null && name != null) { + return activityName + ": " + name; + } + return name != null ? name : intent.toUri(0); + } + + public static String getFriendlyNameForUri( + Context context, PackageManager pm, String uri) { + if (uri == null || uri.startsWith("**")) { + return null; + } + + try { + Intent intent = Intent.parseUri(uri, 0); + if (Intent.ACTION_MAIN.equals(intent.getAction())) { + return getFriendlyActivityName(context, pm, intent, false); + } + return getFriendlyShortcutName(context, pm, intent); + } catch (URISyntaxException e) { + } + + return uri; + } + + public static String getShortcutPreferred( + Context context, PackageManager pm, String uri) { + if (uri == null || uri.startsWith("**")) { + return null; + } + try { + Intent intent = Intent.parseUri(uri, 0); + String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); + if (name == null || name.startsWith("#Intent;")) { + return getFriendlyActivityName(context, pm, intent, false); + } + return name; + } catch (URISyntaxException e) { + } + + return uri; + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/BootlegUtils.java b/core/java/com/android/internal/util/bootleggers/BootlegUtils.java new file mode 100644 index 000000000000..653b3d1c3650 --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/BootlegUtils.java @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2014 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.util.bootleggers; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; +import android.hardware.camera2.CameraAccessException; +import android.hardware.camera2.CameraCharacteristics; +import android.hardware.camera2.CameraManager; +import android.net.ConnectivityManager; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.PowerManager; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.SystemClock; +import android.util.DisplayMetrics; +import android.view.DisplayInfo; +import android.view.IWindowManager; +import android.view.WindowManager; +import android.view.WindowManagerGlobal; + +import com.android.internal.statusbar.IStatusBarService; + +import java.util.Locale; + +public class BootlegUtils { + + private static int sDeviceType = -1; + private static final int DEVICE_PHONE = 0; + private static final int DEVICE_HYBRID = 1; + private static final int DEVICE_TABLET = 2; + public static final String INTENT_SCREENSHOT = "action_take_screenshot"; + public static final String INTENT_REGION_SCREENSHOT = "action_take_region_screenshot"; + + public static boolean isChineseLanguage() { + return Resources.getSystem().getConfiguration().locale.getLanguage().startsWith( + Locale.CHINESE.getLanguage()); + } + + public static boolean deviceSupportsFlashLight(Context context) { + CameraManager cameraManager = (CameraManager) context.getSystemService( + Context.CAMERA_SERVICE); + try { + String[] ids = cameraManager.getCameraIdList(); + for (String id : ids) { + CameraCharacteristics c = cameraManager.getCameraCharacteristics(id); + Boolean flashAvailable = c.get(CameraCharacteristics.FLASH_INFO_AVAILABLE); + Integer lensFacing = c.get(CameraCharacteristics.LENS_FACING); + if (flashAvailable != null + && flashAvailable + && lensFacing != null + && lensFacing == CameraCharacteristics.LENS_FACING_BACK) { + return true; + } + } + } catch (CameraAccessException e) { + // Ignore + } + return false; + } + + public static boolean isPackageAvailable(String packageName, Context context) { + Context mContext = context; + final PackageManager pm = mContext.getPackageManager(); + try { + pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); + int enabled = pm.getApplicationEnabledSetting(packageName); + return enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED && + enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + + public static void switchScreenOff(Context ctx) { + PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE); + if (pm!= null) { + pm.goToSleep(SystemClock.uptimeMillis()); + } + } + + public static boolean isWifiOnly(Context context) { + ConnectivityManager cm = (ConnectivityManager)context.getSystemService( + Context.CONNECTIVITY_SERVICE); + return (cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false); + } + + public static boolean isPackageInstalled(Context context, String pkg, boolean ignoreState) { + if (pkg != null) { + try { + PackageInfo pi = context.getPackageManager().getPackageInfo(pkg, 0); + if (!pi.applicationInfo.enabled && !ignoreState) { + return false; + } + } catch (NameNotFoundException e) { + return false; + } + } + + return true; + } + + public static void takeScreenshot(boolean full) { + IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); + try { + wm.sendCustomAction(new Intent(full? INTENT_SCREENSHOT : INTENT_REGION_SCREENSHOT)); + } catch (RemoteException e) { + e.printStackTrace(); + } + } + + public static boolean isPackageInstalled(Context context, String pkg) { + return isPackageInstalled(context, pkg, true); + } + + public static boolean deviceHasFlashlight(Context ctx) { + return ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); + } + + public static void toggleCameraFlash() { + FireActions.toggleCameraFlash(); + } + + private static final class FireActions { + private static IStatusBarService mStatusBarService = null; + + private static IStatusBarService getStatusBarService() { + synchronized (FireActions.class) { + if (mStatusBarService == null) { + mStatusBarService = IStatusBarService.Stub.asInterface( + ServiceManager.getService("statusbar")); + } + return mStatusBarService; + } + } + + public static void toggleCameraFlash() { + IStatusBarService service = getStatusBarService(); + if (service != null) { + try { + service.toggleCameraFlash(); + } catch (RemoteException e) { + // do nothing. + } + } + } + } + + private static int getScreenType(Context context) { + if (sDeviceType == -1) { + WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); + DisplayInfo outDisplayInfo = new DisplayInfo(); + wm.getDefaultDisplay().getDisplayInfo(outDisplayInfo); + int shortSize = Math.min(outDisplayInfo.logicalHeight, outDisplayInfo.logicalWidth); + int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT + / outDisplayInfo.logicalDensityDpi; + if (shortSizeDp < 600) { + // 0-599dp: "phone" UI with a separate status & navigation bar + sDeviceType = DEVICE_PHONE; + } else if (shortSizeDp < 720) { + // 600-719dp: "phone" UI with modifications for larger screens + sDeviceType = DEVICE_HYBRID; + } else { + // 720dp: "tablet" UI with a single combined status & navigation bar + sDeviceType = DEVICE_TABLET; + } + } + return sDeviceType; + } + + public static boolean isPhone(Context context) { + return getScreenType(context) == DEVICE_PHONE; + } + + public static boolean isHybrid(Context context) { + return getScreenType(context) == DEVICE_HYBRID; + } + + public static boolean isTablet(Context context) { + return getScreenType(context) == DEVICE_TABLET; + } + + // Omni Switch Constants + + /** + * Package name of the omnniswitch app + */ + public static final String APP_PACKAGE_NAME = "org.omnirom.omniswitch"; + + /** + * Intent broadcast action for showing the omniswitch overlay + */ + public static final String ACTION_SHOW_OVERLAY = APP_PACKAGE_NAME + ".ACTION_SHOW_OVERLAY"; + + /** + * Intent broadcast action for hiding the omniswitch overlay + */ + public static final String ACTION_HIDE_OVERLAY = APP_PACKAGE_NAME + ".ACTION_HIDE_OVERLAY"; + + /** + * Intent broadcast action for toogle the omniswitch overlay + */ + public static final String ACTION_TOGGLE_OVERLAY = APP_PACKAGE_NAME + ".ACTION_TOGGLE_OVERLAY"; + + /** + * Intent broadcast action for restoring the home stack + */ + public static final String ACTION_RESTORE_HOME_STACK = APP_PACKAGE_NAME + ".ACTION_RESTORE_HOME_STACK"; + + /** + * Intent for launching the omniswitch settings actvity + */ + public static Intent INTENT_LAUNCH_APP = new Intent(Intent.ACTION_MAIN) + .setClassName(APP_PACKAGE_NAME, APP_PACKAGE_NAME + ".SettingsActivity"); +} diff --git a/core/java/com/android/internal/util/bootleggers/ConfigSplitHelper.java b/core/java/com/android/internal/util/bootleggers/ConfigSplitHelper.java new file mode 100644 index 000000000000..a023b4caf3ca --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/ConfigSplitHelper.java @@ -0,0 +1,98 @@ +/* +* Copyright (C) 2014 SlimRoms 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.util.bootleggers; + +import android.content.Context; +import android.content.pm.PackageManager; +import android.content.res.Resources; +import android.util.Log; + +import java.util.ArrayList; + +public class ConfigSplitHelper { + + private static final String SETTINGS_METADATA_NAME = "com.android.settings"; + + public static ArrayList getActionConfigValues(Context context, String config, + String values, String entries, boolean isShortcut) { + // init vars to fill with them later the config values + int counter = 0; + ArrayList actionConfigList = new ArrayList(); + ActionConfig actionConfig = null; + + PackageManager pm = context.getPackageManager(); + Resources settingsResources = null; + try { + settingsResources = pm.getResourcesForApplication(SETTINGS_METADATA_NAME); + } catch (Exception e) { + Log.e("ConfigSplitHelper", "can't access settings resources",e); + } + + // Split out the config to work with and add to the list + for (String configValue : config.split("\\" + ActionConstants.ACTION_DELIMITER)) { + counter++; + if (counter == 1) { + actionConfig = new ActionConfig(configValue, + AppHelper.getProperSummary(context, pm, settingsResources, + configValue, values, entries), null, null, null); + } + if (counter == 2) { + if (isShortcut) { + actionConfig.setIcon(configValue); + actionConfigList.add(actionConfig); + //reset counter due that shortcut iteration of one action is finished + counter = 0; + } else { + actionConfig.setLongpressAction(configValue); + actionConfig.setLongpressActionDescription( + AppHelper.getProperSummary(context, pm, settingsResources, + configValue, values, entries)); + } + } + if (counter == 3) { + actionConfig.setIcon(configValue); + actionConfigList.add(actionConfig); + //reset counter due that iteration of full config action is finished + counter = 0; + } + } + + return actionConfigList; + } + + public static String setActionConfig( + ArrayList actionConfigs, boolean isShortcut) { + String finalConfig = ""; + ActionConfig actionConfig; + + for (int i = 0; i < actionConfigs.size(); i++) { + if (i != 0) { + finalConfig += ActionConstants.ACTION_DELIMITER; + } + actionConfig = actionConfigs.get(i); + finalConfig += actionConfig.getClickAction() + ActionConstants.ACTION_DELIMITER; + if (!isShortcut) { + finalConfig += actionConfig.getLongpressAction() + + ActionConstants.ACTION_DELIMITER; + } + finalConfig += actionConfig.getIcon(); + } + + return finalConfig; + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/Converter.java b/core/java/com/android/internal/util/bootleggers/Converter.java new file mode 100644 index 000000000000..3385ae70e424 --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/Converter.java @@ -0,0 +1,30 @@ +/* +* Copyright (C) 2014 SlimRoms 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.util.bootleggers; + +import android.content.Context; + +public class Converter { + + public static int dpToPx(Context context, int dp) { + return (int) ((dp * context.getResources().getDisplayMetrics().density) + 0.5); + } + + public static int pxToDp(Context context, int px) { + return (int) ((px / context.getResources().getDisplayMetrics().density) + 0.5); + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/DeviceUtils.java b/core/java/com/android/internal/util/bootleggers/DeviceUtils.java new file mode 100644 index 000000000000..29937a7f54ef --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/DeviceUtils.java @@ -0,0 +1,169 @@ +/* +* Copyright (C) 2014 SlimRoms 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.util.bootleggers; + +import android.bluetooth.BluetoothAdapter; +import android.content.ContentResolver; +import android.content.Context; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.res.Resources; +import android.hardware.display.DisplayManager; +import android.hardware.display.WifiDisplayStatus; +import android.net.ConnectivityManager; +import android.nfc.NfcAdapter; +import android.provider.Settings; +import android.os.Vibrator; +import android.telephony.TelephonyManager; +import android.util.DisplayMetrics; +import android.view.DisplayInfo; +import android.view.WindowManager; +import android.util.Log; + +import com.android.internal.telephony.PhoneConstants; + +import java.util.ArrayList; +import java.util.List; + +public class DeviceUtils { + + private static final String SETTINGS_METADATA_NAME = "com.android.settings"; + + // Device types + private static final int DEVICE_PHONE = 0; + private static final int DEVICE_HYBRID = 1; + private static final int DEVICE_TABLET = 2; + + public static boolean deviceSupportsRemoteDisplay(Context ctx) { + DisplayManager dm = (DisplayManager) ctx.getSystemService(Context.DISPLAY_SERVICE); + return (dm.getWifiDisplayStatus().getFeatureState() + != WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE); + } + + public static boolean deviceSupportsUsbTether(Context context) { + ConnectivityManager cm = + (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + return (cm.getTetherableUsbRegexs().length != 0); + } + + public static boolean deviceSupportsMobileData(Context context) { + ConnectivityManager cm = + (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + return cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE); + } + + public static boolean deviceSupportsBluetooth() { + return (BluetoothAdapter.getDefaultAdapter() != null); + } + + public static boolean deviceSupportsNfc(Context context) { + return NfcAdapter.getDefaultAdapter(context) != null; + } + + public static boolean deviceSupportsLte(Context context) { + final TelephonyManager tm = + (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + return (tm.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE); + // || tm.getLteOnGsmMode() != 0; // add back if when we have support on LP for it + } + + public static boolean deviceSupportsGps(Context context) { + return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS); + } + + public static boolean adbEnabled(ContentResolver resolver) { + return (Settings.Global.getInt(resolver, Settings.Global.ADB_ENABLED, 0)) == 1; + } + + public static boolean deviceSupportsVibrator(Context ctx) { + Vibrator vibrator = (Vibrator) ctx.getSystemService(Context.VIBRATOR_SERVICE); + return vibrator.hasVibrator(); + } + + public static boolean deviceSupportsTorch(Context context) { + // Need to be adapted to new torch API + return true; + } + + public static FilteredDeviceFeaturesArray filterUnsupportedDeviceFeatures(Context context, + String[] valuesArray, String[] entriesArray) { + if (valuesArray == null || entriesArray == null || context == null) { + return null; + } + List finalEntries = new ArrayList(); + List finalValues = new ArrayList(); + FilteredDeviceFeaturesArray filteredDeviceFeaturesArray = + new FilteredDeviceFeaturesArray(); + + for (int i = 0; i < valuesArray.length; i++) { + if (isSupportedFeature(context, valuesArray[i])) { + finalEntries.add(entriesArray[i]); + finalValues.add(valuesArray[i]); + } + } + filteredDeviceFeaturesArray.entries = + finalEntries.toArray(new String[finalEntries.size()]); + filteredDeviceFeaturesArray.values = + finalValues.toArray(new String[finalValues.size()]); + return filteredDeviceFeaturesArray; + } + + private static boolean isSupportedFeature(Context context, String action) { + if (action.equals(ActionConstants.ACTION_TORCH) + && !deviceSupportsTorch(context) + || action.equals(ActionConstants.ACTION_VIB) + && !deviceSupportsVibrator(context) + || action.equals(ActionConstants.ACTION_VIB_SILENT) + && !deviceSupportsVibrator(context)) { + return false; + } + return true; + } + + public static class FilteredDeviceFeaturesArray { + public String[] entries; + public String[] values; + } + + private static int getScreenType(Context con) { + WindowManager wm = (WindowManager)con.getSystemService(Context.WINDOW_SERVICE); + DisplayInfo outDisplayInfo = new DisplayInfo(); + wm.getDefaultDisplay().getDisplayInfo(outDisplayInfo); + int shortSize = Math.min(outDisplayInfo.logicalHeight, outDisplayInfo.logicalWidth); + int shortSizeDp = + shortSize * DisplayMetrics.DENSITY_DEFAULT / outDisplayInfo.logicalDensityDpi; + if (shortSizeDp < 600) { + return DEVICE_PHONE; + } else if (shortSizeDp < 720) { + return DEVICE_HYBRID; + } else { + return DEVICE_TABLET; + } + } + + public static boolean isPhone(Context con) { + return getScreenType(con) == DEVICE_PHONE; + } + + public static boolean isHybrid(Context con) { + return getScreenType(con) == DEVICE_HYBRID; + } + + public static boolean isTablet(Context con) { + return getScreenType(con) == DEVICE_TABLET; + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/FileUtils.java b/core/java/com/android/internal/util/bootleggers/FileUtils.java new file mode 100644 index 000000000000..c10fc63a7a4a --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/FileUtils.java @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2016 The CyanogenMod 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.util.bootleggers; + +import android.util.Log; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + +public final class FileUtils { + private static final String TAG = "FileUtils"; + + private FileUtils() { + // This class is not supposed to be instantiated + } + + /** + * Reads the first line of text from the given file. + * Reference {@link BufferedReader#readLine()} for clarification on what a line is + * + * @return the read line contents, or null on failure + */ + public static String readOneLine(String fileName) { + String line = null; + BufferedReader reader = null; + + try { + reader = new BufferedReader(new FileReader(fileName), 512); + line = reader.readLine(); + } catch (FileNotFoundException e) { + Log.w(TAG, "No such file " + fileName + " for reading", e); + } catch (IOException e) { + Log.e(TAG, "Could not read from file " + fileName, e); + } finally { + try { + if (reader != null) { + reader.close(); + } + } catch (IOException e) { + // Ignored, not much we can do anyway + } + } + + return line; + } + + /** + * Writes the given value into the given file + * + * @return true on success, false on failure + */ + public static boolean writeLine(String fileName, String value) { + BufferedWriter writer = null; + + try { + writer = new BufferedWriter(new FileWriter(fileName)); + writer.write(value); + } catch (FileNotFoundException e) { + Log.w(TAG, "No such file " + fileName + " for writing", e); + return false; + } catch (IOException e) { + Log.e(TAG, "Could not write to file " + fileName, e); + return false; + } finally { + try { + if (writer != null) { + writer.close(); + } + } catch (IOException e) { + // Ignored, not much we can do anyway + } + } + + return true; + } + + /** + * Checks whether the given file exists + * + * @return true if exists, false if not + */ + public static boolean fileExists(String fileName) { + final File file = new File(fileName); + return file.exists(); + } + + /** + * Checks whether the given file is readable + * + * @return true if readable, false if not + */ + public static boolean isFileReadable(String fileName) { + final File file = new File(fileName); + return file.exists() && file.canRead(); + } + + /** + * Checks whether the given file is writable + * + * @return true if writable, false if not + */ + public static boolean isFileWritable(String fileName) { + final File file = new File(fileName); + return file.exists() && file.canWrite(); + } +} diff --git a/core/java/com/android/internal/util/bootleggers/Helpers.java b/core/java/com/android/internal/util/bootleggers/Helpers.java new file mode 100644 index 000000000000..60946ad91b37 --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/Helpers.java @@ -0,0 +1,30 @@ +package com.android.internal.util.bootleggers; + +import android.app.ActivityManager; +import android.app.ActivityManagerNative; +import android.app.IActivityManager; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; + +public class Helpers { + // avoids hardcoding the tag + private static final String TAG = Thread.currentThread().getStackTrace()[1].getClassName(); + + public static void restartSystemUI(Context context) { + try { + ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); + IActivityManager amn = ActivityManagerNative.getDefault(); + context.stopService(new Intent().setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService"))); + am.killBackgroundProcesses("com.android.systemui"); + for (ActivityManager.RunningAppProcessInfo app : am.getRunningAppProcesses()) { + if ("com.android.systemui".equals(app.processName)) { + amn.killApplicationProcess(app.processName, app.uid); + break; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/core/java/com/android/internal/util/bootleggers/ImageHelper.java b/core/java/com/android/internal/util/bootleggers/ImageHelper.java new file mode 100644 index 000000000000..56166b4a7984 --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/ImageHelper.java @@ -0,0 +1,250 @@ +/* +* Copyright (C) 2013 SlimRoms 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.util.bootleggers; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Bitmap.Config; +import android.graphics.BitmapShader; +import android.graphics.Canvas; +import android.graphics.ColorMatrix; +import android.graphics.ColorMatrixColorFilter; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.PorterDuffXfermode; +import android.graphics.PorterDuff.Mode; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Shader.TileMode; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.renderscript.Element; +import android.renderscript.Allocation; +import android.renderscript.ScriptIntrinsicBlur; +import android.renderscript.RenderScript; +import android.util.DisplayMetrics; +import android.util.TypedValue; +import android.view.WindowManager; + +public class ImageHelper { + + public static Bitmap getColoredBitmap(Drawable d, int color) { + if (d == null) { + return null; + } + Bitmap colorBitmap = ((BitmapDrawable) d).getBitmap(); + Bitmap grayscaleBitmap = toGrayscale(colorBitmap); + Paint pp = new Paint(); + pp.setAntiAlias(true); + PorterDuffColorFilter frontFilter = + new PorterDuffColorFilter(color, Mode.MULTIPLY); + pp.setColorFilter(frontFilter); + Canvas cc = new Canvas(grayscaleBitmap); + final Rect rect = new Rect(0, 0, grayscaleBitmap.getWidth(), grayscaleBitmap.getHeight()); + cc.drawBitmap(grayscaleBitmap, rect, rect, pp); + return grayscaleBitmap; + } + + public static Bitmap toGrayscale(Bitmap bmpOriginal) { + int width, height; + height = bmpOriginal.getHeight(); + width = bmpOriginal.getWidth(); + try { + bmpOriginal = RGB565toARGB888(bmpOriginal); + } catch (Exception e) { + e.printStackTrace(); + } + + Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas c = new Canvas(bmpGrayscale); + Paint paint = new Paint(); + paint.setAntiAlias(true); + ColorMatrix cm = new ColorMatrix(); + final Rect rect = new Rect(0, 0, width, height); + cm.setSaturation(0); + + ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm); + paint.setColorFilter(f); + c.drawBitmap(bmpOriginal, rect, rect, paint); + return bmpGrayscale; + } + + public static Bitmap getGrayscaleBlurredImage(Context context, Bitmap image) { + return getGrayscaleBlurredImage(context, image, 3.5f); + } + + public static Bitmap getGrayscaleBlurredImage(Context context, Bitmap image, float radius) { + Bitmap finalImage = Bitmap.createBitmap( + image.getWidth(), image.getHeight(), + Bitmap.Config.ARGB_8888); + finalImage = toGrayscale(getBlurredImage(context, image, radius)); + return finalImage; + } + + public static Drawable resize(Context context, Drawable image, int size) { + if (image == null || context == null) { + return null; + } + + int newSize = Converter.dpToPx(context, size); + Bitmap bitmap = ((BitmapDrawable) image).getBitmap(); + Bitmap scaledBitmap = Bitmap.createBitmap(newSize, newSize, Config.ARGB_8888); + + float ratioX = newSize / (float) bitmap.getWidth(); + float ratioY = newSize / (float) bitmap.getHeight(); + float middleX = newSize / 2.0f; + float middleY = newSize / 2.0f; + + final Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); + paint.setAntiAlias(true); + + Matrix scaleMatrix = new Matrix(); + scaleMatrix.setScale(ratioX, ratioY, middleX, middleY); + + Canvas canvas = new Canvas(scaledBitmap); + canvas.setMatrix(scaleMatrix); + canvas.drawBitmap(bitmap, middleX - bitmap.getWidth() / 2, + middleY - bitmap.getHeight() / 2, paint); + return new BitmapDrawable(context.getResources(), scaledBitmap); + } + + public static Bitmap resizeMaxDeviceSize(Context context, Drawable image) { + Bitmap i2b = ((BitmapDrawable) image).getBitmap(); + return resizeMaxDeviceSize(context, i2b); + } + + public static Bitmap resizeMaxDeviceSize(Context context, Bitmap image) { + Bitmap imageToBitmap; + DisplayMetrics metrics = new DisplayMetrics(); + WindowManager wm = context.getSystemService(WindowManager.class); + wm.getDefaultDisplay().getRealMetrics(metrics); + int maxHeight = metrics.heightPixels; + int maxWidth = metrics.widthPixels; + try { + imageToBitmap = RGB565toARGB888(image); + if (maxHeight > 0 && maxWidth > 0) { + int width = imageToBitmap.getWidth(); + int height = imageToBitmap.getHeight(); + float ratioBitmap = (float) width / (float) height; + float ratioMax = (float) maxWidth / (float) maxHeight; + + int finalWidth = maxWidth; + int finalHeight = maxHeight; + if (ratioMax > ratioBitmap) { + finalWidth = (int) ((float)maxHeight * ratioBitmap); + } else { + finalHeight = (int) ((float)maxWidth / ratioBitmap); + } + imageToBitmap = Bitmap.createScaledBitmap(imageToBitmap, finalWidth, finalHeight, true); + return imageToBitmap; + } + } catch (Exception e) { + e.printStackTrace(); + } + return image; + } + + public static Bitmap getRoundedCornerBitmap(Bitmap bitmap) { + if (bitmap == null) { + return null; + } + Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), + Config.ARGB_8888); + Canvas canvas = new Canvas(output); + + final int color = 0xff424242; + final Paint paint = new Paint(); + final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); + final RectF rectF = new RectF(rect); + final float roundPx = 24; + paint.setAntiAlias(true); + canvas.drawARGB(0, 0, 0, 0); + paint.setColor(color); + canvas.drawRoundRect(rectF, roundPx, roundPx, paint); + paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); + canvas.drawBitmap(bitmap, rect, rect, paint); + return output; + } + + public static Bitmap getCircleBitmap(Bitmap bitmap) { + if (bitmap == null) { + return null; + } + int width = bitmap.getWidth(); + int height = bitmap.getHeight(); + + Bitmap output = Bitmap.createBitmap(width, height, + Config.ARGB_8888); + Canvas canvas = new Canvas(output); + + BitmapShader shader = new BitmapShader(bitmap, TileMode.CLAMP, TileMode.CLAMP); + final Paint paint = new Paint(); + paint.setAntiAlias(true); + paint.setShader(shader); + + canvas.drawCircle(width/2, height/2, width/2, paint); + + return output; + } + + public static Bitmap getBlurredImage(Context context, Bitmap image) { + return getBlurredImage(context, image, 3.5f); + } + + public static Bitmap getBlurredImage(Context context, Bitmap image, float radius) { + try { + image = RGB565toARGB888(image); + } catch (Exception e) { + e.printStackTrace(); + } + + Bitmap bitmap = Bitmap.createBitmap( + image.getWidth(), image.getHeight(), + Bitmap.Config.ARGB_8888); + RenderScript renderScript = RenderScript.create(context); + Allocation blurInput = Allocation.createFromBitmap(renderScript, image); + Allocation blurOutput = Allocation.createFromBitmap(renderScript, bitmap); + + ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(renderScript, + Element.U8_4(renderScript)); + blur.setInput(blurInput); + blur.setRadius(radius); // radius must be 0 < r <= 25 + blur.forEach(blurOutput); + blurOutput.copyTo(bitmap); + renderScript.destroy(); + + return bitmap; + } + + private static Bitmap RGB565toARGB888(Bitmap img) throws Exception { + int numPixels = img.getWidth() * img.getHeight(); + int[] pixels = new int[numPixels]; + + //Get JPEG pixels. Each int is the color values for one pixel. + img.getPixels(pixels, 0, img.getWidth(), 0, 0, img.getWidth(), img.getHeight()); + + //Create a Bitmap of the appropriate format. + Bitmap result = Bitmap.createBitmap(img.getWidth(), img.getHeight(), Bitmap.Config.ARGB_8888); + + //Set RGB pixels. + result.setPixels(pixels, 0, result.getWidth(), 0, 0, result.getWidth(), result.getHeight()); + return result; + } + +} diff --git a/core/java/com/android/internal/util/bootleggers/KeyDisabler.java b/core/java/com/android/internal/util/bootleggers/KeyDisabler.java new file mode 100644 index 000000000000..d0980b7edd8c --- /dev/null +++ b/core/java/com/android/internal/util/bootleggers/KeyDisabler.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2014 The CyanogenMod 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.util.bootleggers; + +/* + * Disable capacitive keys + * + * This is intended for use on devices in which the capacitive keys + * can be fully disabled for replacement with a soft navbar. You + * really should not be using this on a device with mechanical or + * otherwise visible-when-inactive keys + */ + +public class KeyDisabler { + + /* + * All HAF classes should export this boolean. + * Real implementations must, of course, return true + */ + + public static boolean isSupported() { return false; } + + /* + * Are the keys currently blocked? + */ + + public static boolean isActive() { + return false; + } + + /* + * Disable capacitive keys + */ + + public static boolean setActive(boolean state) { + throw new UnsupportedOperationException(); + } + +} diff --git a/core/java/com/android/internal/util/custom/cutout/CutoutFullscreenController.java b/core/java/com/android/internal/util/custom/cutout/CutoutFullscreenController.java new file mode 100644 index 000000000000..f2887af7e75c --- /dev/null +++ b/core/java/com/android/internal/util/custom/cutout/CutoutFullscreenController.java @@ -0,0 +1,116 @@ +/** + * Copyright (C) 2018 The LineageOS project + * Copyright (C) 2019 The PixelExperience 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.util.custom.cutout; + +import android.content.ContentResolver; +import android.content.Context; +import android.content.res.Resources; +import android.database.ContentObserver; +import android.os.Handler; +import android.os.Looper; +import android.os.UserHandle; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import android.provider.Settings; + +public class CutoutFullscreenController { + private Set mApps = new HashSet<>(); + private Context mContext; + + private final boolean isAvailable; + + public CutoutFullscreenController(Context context) { + mContext = context; + final Resources resources = mContext.getResources(); + + isAvailable = CutoutUtils.hasCutout(context); + + if (!isAvailable) { + return; + } + + SettingsObserver observer = new SettingsObserver( + new Handler(Looper.getMainLooper())); + observer.observe(); + } + + public boolean isSupported() { + return isAvailable; + } + + public boolean shouldForceCutoutFullscreen(String packageName) { + return isSupported() && mApps.contains(packageName); + } + + public Set getApps() { + return mApps; + } + + public void addApp(String packageName) { + mApps.add(packageName); + Settings.System.putString(mContext.getContentResolver(), + Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS, String.join(",", mApps)); + } + + public void removeApp(String packageName) { + mApps.remove(packageName); + Settings.System.putString(mContext.getContentResolver(), + Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS, String.join(",", mApps)); + } + + public void setApps(Set apps) { + mApps = apps; + } + + class SettingsObserver extends ContentObserver { + SettingsObserver(Handler handler) { + super(handler); + } + + void observe() { + ContentResolver resolver = mContext.getContentResolver(); + + resolver.registerContentObserver(Settings.System.getUriFor( + Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS), false, this, + UserHandle.USER_ALL); + + update(); + } + + @Override + public void onChange(boolean selfChange) { + update(); + } + + public void update() { + ContentResolver resolver = mContext.getContentResolver(); + + String apps = Settings.System.getStringForUser(resolver, + Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS, + UserHandle.USER_CURRENT); + if (apps != null) { + setApps(new HashSet<>(Arrays.asList(apps.split(",")))); + } else { + setApps(new HashSet<>()); + } + } + } +} \ No newline at end of file diff --git a/core/java/com/android/internal/util/custom/cutout/CutoutUtils.java b/core/java/com/android/internal/util/custom/cutout/CutoutUtils.java new file mode 100644 index 000000000000..040729ab248c --- /dev/null +++ b/core/java/com/android/internal/util/custom/cutout/CutoutUtils.java @@ -0,0 +1,40 @@ +/* +* Copyright (C) 2019 The Pixel Experience 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.util.custom.cutout; + +import android.content.Context; + +public class CutoutUtils { + public static boolean hasCutout(Context context) { + boolean hasCutout = context.getResources().getBoolean(com.android.internal.R.bool.config_physicalDisplayCutout); + if (hasCutout){ + return !context.getResources().getBoolean( + com.android.internal.R.bool.config_maskMainBuiltInDisplayCutout); + } + return false; + } + public static boolean hasBigCutout(Context context) { + if (!hasCutout(context)){ + return false; + } + boolean hasBigCutout = context.getResources().getBoolean(com.android.internal.R.bool.config_bigPhysicalDisplayCutout); + if (hasBigCutout){ + return !context.getResources().getBoolean( + com.android.internal.R.bool.config_maskMainBuiltInDisplayCutout); + } + return false; + } +} diff --git a/core/java/com/android/internal/util/omni/OmniJawsClient.java b/core/java/com/android/internal/util/omni/OmniJawsClient.java new file mode 100644 index 000000000000..3c20b2b8f259 --- /dev/null +++ b/core/java/com/android/internal/util/omni/OmniJawsClient.java @@ -0,0 +1,551 @@ +/* +* Copyright (C) 2017 The OmniROM Project +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +*/ +package com.android.internal.util.omni; + +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; +import android.database.ContentObserver; +import android.database.Cursor; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Handler; +import android.os.UserHandle; +import android.provider.Settings; +import android.util.Log; + +public class OmniJawsClient { + private static final String TAG = "SystemUI:OmniJawsClient"; + private static final boolean DEBUG = false; + public static final String SERVICE_PACKAGE = "org.omnirom.omnijaws"; + public static final Uri WEATHER_URI + = Uri.parse("content://org.omnirom.omnijaws.provider/weather"); + public static final Uri SETTINGS_URI + = Uri.parse("content://org.omnirom.omnijaws.provider/settings"); + + private static final String ICON_PACKAGE_DEFAULT = "org.omnirom.omnijaws"; + private static final String ICON_PREFIX_DEFAULT = "outline"; + private static final String EXTRA_ERROR = "error"; + public static final int EXTRA_ERROR_NETWORK = 0; + public static final int EXTRA_ERROR_LOCATION = 1; + public static final int EXTRA_ERROR_DISABLED = 2; + + public static final String[] WEATHER_PROJECTION = new String[]{ + "city", + "wind_speed", + "wind_direction", + "condition_code", + "temperature", + "humidity", + "condition", + "forecast_low", + "forecast_high", + "forecast_condition", + "forecast_condition_code", + "time_stamp", + "forecast_date", + "pin_wheel" + }; + + final String[] SETTINGS_PROJECTION = new String[] { + "enabled", + "units", + "provider", + "setup" + }; + + private static final String WEATHER_UPDATE = "org.omnirom.omnijaws.WEATHER_UPDATE"; + private static final String WEATHER_ERROR = "org.omnirom.omnijaws.WEATHER_ERROR"; + + private static final String SETTINGS_PACKAGE_NAME = "com.android.settings"; + private static final String WEATHER_SETTINGS = "com.android.settings.Settings$OmniJawsSettingsActivity"; + + private static final DecimalFormat sNoDigitsFormat = new DecimalFormat("0"); + + public static class WeatherInfo { + public String city; + public String windSpeed; + public String windDirection; + public int conditionCode; + public String temp; + public String humidity; + public String condition; + public Long timeStamp; + public List forecasts; + public String tempUnits; + public String windUnits; + public String provider; + public String pinWheel; + + public String toString() { + return city + ":" + new Date(timeStamp) + ": " + windSpeed + ":" + windDirection + ":" +conditionCode + ":" + temp + ":" + humidity + ":" + condition + ":" + tempUnits + ":" + windUnits + ": " + forecasts; + } + + public String getLastUpdateTime() { + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + return sdf.format(new Date(timeStamp)); + } + } + + public static class DayForecast { + public String low; + public String high; + public int conditionCode; + public String condition; + public String date; + + public String toString() { + return "[" + low + ":" + high + ":" +conditionCode + ":" + condition + ":" + date + "]"; + } + } + + public static class PackageInfo { + public String packageName; + public int resourceID; + + public String toString() { + return "[" + packageName + ":" + resourceID + "]"; + } + } + + public static interface OmniJawsObserver { + public void weatherUpdated(); + public void weatherError(int errorReason); + default public void updateSettings() {}; + } + + private class WeatherUpdateReceiver extends BroadcastReceiver { + @Override + public void onReceive(final Context context, Intent intent) { + String action = intent.getAction(); + for (OmniJawsObserver observer : mObserver) { + if (action.equals(WEATHER_UPDATE)) { + observer.weatherUpdated(); + } + if (action.equals(WEATHER_ERROR)) { + int errorReason = intent.getIntExtra(EXTRA_ERROR, 0); + observer.weatherError(errorReason); + } + } + } + } + + private class OmniJawsSettingsObserver extends ContentObserver { + OmniJawsSettingsObserver(Handler handler) { + super(handler); + } + + void observe() { + mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor( + Settings.System.OMNIJAWS_WEATHER_ICON_PACK), + false, this, UserHandle.USER_ALL); + update(); + } + + @Override + public void onChange(boolean selfChange) { + update(); + } + + public void update() { + updateSettings(); + } + + public void unregister() { + mContext.getContentResolver().unregisterContentObserver(this); + } + } + + private Context mContext; + private WeatherInfo mCachedInfo; + private PackageInfo mImageInfo; + private Resources mRes; + private String mPackageName; + private String mIconPrefix; + private String mSettingIconPackage; + private boolean mMetric; + private List mObserver; + private WeatherUpdateReceiver mReceiver; + private OmniJawsSettingsObserver mSettingsObserver; + private Handler mHandler = new Handler(); + + public OmniJawsClient(Context context) { + mContext = context; + mObserver = new ArrayList(); + mSettingsObserver = new OmniJawsSettingsObserver(mHandler); + mSettingsObserver.observe(); + } + + public OmniJawsClient(Context context, boolean settingsObserver) { + mContext = context; + mObserver = new ArrayList(); + if (settingsObserver) { + mSettingsObserver = new OmniJawsSettingsObserver(mHandler); + mSettingsObserver.observe(); + } + } + + public void addSettingsObserver() { + if (mSettingsObserver == null) { + mSettingsObserver = new OmniJawsSettingsObserver(mHandler); + mSettingsObserver.observe(); + } + } + + public void cleanupObserver() { + if (mReceiver != null) { + try { + mContext.unregisterReceiver(mReceiver); + } catch (Exception e) { + } + mReceiver = null; + } + if (mSettingsObserver != null) { + mSettingsObserver.unregister(); + } + } + + public void updateWeather() { + if (isOmniJawsServiceInstalled()) { + Intent updateIntent = new Intent(Intent.ACTION_MAIN) + .setClassName(SERVICE_PACKAGE, SERVICE_PACKAGE + ".WeatherService"); + updateIntent.setAction(SERVICE_PACKAGE + ".ACTION_UPDATE"); + mContext.startService(updateIntent); + } + } + + public Intent getSettingsIntent() { + if (isOmniJawsServiceInstalled()) { + Intent settings = new Intent(Intent.ACTION_MAIN); + settings.setClassName(SETTINGS_PACKAGE_NAME, WEATHER_SETTINGS); + return settings; + } + return null; + } + + public WeatherInfo getWeatherInfo() { + return mCachedInfo; + } + + public PackageInfo getPackageInfo() { + return mImageInfo; + } + + private static String getFormattedValue(float value) { + if (Float.isNaN(value)) { + return "-"; + } + String formatted = sNoDigitsFormat.format(value); + if (formatted.equals("-0")) { + formatted = "0"; + } + return formatted; + } + + public void queryWeather() { + if (!isOmniJawsEnabled()) { + Log.w(TAG, "queryWeather while disabled"); + mCachedInfo = null; + return; + } + Cursor c = mContext.getContentResolver().query(WEATHER_URI, WEATHER_PROJECTION, + null, null, null); + mCachedInfo = null; + if (c != null) { + try { + int count = c.getCount(); + if (count > 0) { + mCachedInfo = new WeatherInfo(); + List forecastList = new ArrayList(); + int i = 0; + for (i = 0; i < count; i++) { + c.moveToPosition(i); + if (i == 0) { + mCachedInfo.city = c.getString(0); + mCachedInfo.windSpeed = getFormattedValue(c.getFloat(1)); + mCachedInfo.windDirection = String.valueOf(c.getInt(2)) + "\u00b0"; + mCachedInfo.conditionCode = c.getInt(3); + mCachedInfo.temp = getFormattedValue(c.getFloat(4)); + mCachedInfo.humidity = c.getString(5); + mCachedInfo.condition = c.getString(6); + mCachedInfo.timeStamp = Long.valueOf(c.getString(11)); + mCachedInfo.pinWheel = c.getString(13); + } else { + DayForecast day = new DayForecast(); + day.low = getFormattedValue(c.getFloat(7)); + day.high = getFormattedValue(c.getFloat(8)); + day.condition = c.getString(9); + day.conditionCode = c.getInt(10); + day.date = c.getString(12); + forecastList.add(day); + } + } + mCachedInfo.forecasts = forecastList; + } + } finally { + c.close(); + } + } + updateUnits(); + if (DEBUG) Log.d(TAG, "queryWeather " + mCachedInfo); + } + + private void loadDefaultIconsPackage() { + mPackageName = ICON_PACKAGE_DEFAULT; + mIconPrefix = ICON_PREFIX_DEFAULT; + mSettingIconPackage = mPackageName + "." + mIconPrefix; + if (DEBUG) Log.d(TAG, "Load default icon pack " + mSettingIconPackage + " " + mPackageName + " " + mIconPrefix); + try { + PackageManager packageManager = mContext.getPackageManager(); + mRes = packageManager.getResourcesForApplication(mPackageName); + } catch (Exception e) { + mRes = null; + } + if (mRes == null) { + Log.w(TAG, "No default package found"); + } + } + + private Drawable getDefaultConditionImage() { + String packageName = ICON_PACKAGE_DEFAULT; + String iconPrefix = ICON_PREFIX_DEFAULT; + + try { + PackageManager packageManager = mContext.getPackageManager(); + Resources res = packageManager.getResourcesForApplication(packageName); + if (res != null) { + int resId = res.getIdentifier(iconPrefix + "_na", "drawable", packageName); + Drawable d = res.getDrawable(resId); + if (d != null) { + setWeatherConditionImageResources(resId, packageName); + return d; + } + } + } catch (Exception e) { + } + // absolute absolute fallback + Log.w(TAG, "No default package found"); + return new ColorDrawable(Color.RED); + } + + private void loadCustomIconPackage() { + int idx = mSettingIconPackage.lastIndexOf("."); + mPackageName = mSettingIconPackage.substring(0, idx); + mIconPrefix = mSettingIconPackage.substring(idx + 1); + if (DEBUG) Log.d(TAG, "Load custom icon pack " + mSettingIconPackage + " " + mPackageName + " " + mIconPrefix); + try { + PackageManager packageManager = mContext.getPackageManager(); + mRes = packageManager.getResourcesForApplication(mPackageName); + } catch (Exception e) { + mRes = null; + } + if (mRes == null) { + Log.w(TAG, "Icon pack loading failed - loading default"); + loadDefaultIconsPackage(); + } + } + + private void setWeatherConditionImageResources(int resId, String PackageName) { + if (DEBUG) { + Log.d(TAG, "Setting mImageInfo.resourceID:" + resId); + Log.d(TAG, "Setting mImageInfo.packageName:" + PackageName); + } + mImageInfo.packageName = PackageName; + mImageInfo.resourceID = resId; + } + + public Drawable getWeatherConditionImage(int conditionCode) { + if (!isOmniJawsEnabled()) { + Log.w(TAG, "Requesting condition image while disabled"); + return null; + } + if (!isAvailableApp(mPackageName)) { + Log.w(TAG, "Icon pack no longer available - loading default " + mPackageName); + loadDefaultIconsPackage(); + } + if (mRes == null) { + Log.w(TAG, "Requesting condition image while disabled"); + return null; + } + try { + mImageInfo = new PackageInfo(); + int resId = mRes.getIdentifier(mIconPrefix + "_" + conditionCode, "drawable", mPackageName); + Drawable d = mRes.getDrawable(resId); + if (d != null) { + setWeatherConditionImageResources(resId, mPackageName); + return d; + } + Log.w(TAG, "Failed to get condition image for " + conditionCode + " use default"); + resId = mRes.getIdentifier(mIconPrefix + "_na", "drawable", mPackageName); + d = mRes.getDrawable(resId); + if (d != null) { + setWeatherConditionImageResources(resId, mPackageName); + return d; + } + } catch(Exception e) { + } + Log.w(TAG, "Failed to get condition image for " + conditionCode); + return getDefaultConditionImage(); + } + + public boolean isOmniJawsServiceInstalled() { + return isAvailableApp(SERVICE_PACKAGE); + } + + public boolean isOmniJawsEnabled() { + if (!isOmniJawsServiceInstalled()) { + return false; + } + final Cursor c = mContext.getContentResolver().query(SETTINGS_URI, SETTINGS_PROJECTION, + null, null, null); + if (c != null) { + int count = c.getCount(); + if (count == 1) { + c.moveToPosition(0); + boolean enabled = c.getInt(0) == 1; + return enabled; + } + } + return true; + } + + public void setOmniJawsEnabled(boolean value) { + if (isOmniJawsServiceInstalled()) { + // check first time enablement and redirect to settings + // cause we need to enable gps for it + Intent updateIntent = new Intent(Intent.ACTION_MAIN) + .setClassName(SERVICE_PACKAGE, SERVICE_PACKAGE + ".WeatherService"); + updateIntent.setAction(SERVICE_PACKAGE + ".ACTION_ENABLE"); + updateIntent.putExtra("enable", value); + mContext.startService(updateIntent); + } + } + + public boolean isOmniJawsSetupDone() { + if (!isOmniJawsServiceInstalled()) { + return false; + } + final Cursor c = mContext.getContentResolver().query(SETTINGS_URI, SETTINGS_PROJECTION, + null, null, null); + if (c != null) { + int count = c.getCount(); + if (count == 1) { + c.moveToPosition(0); + boolean setupDone = c.getInt(3) == 1; + return setupDone; + } + } + return true; + } + + private void updateUnits() { + if (!isOmniJawsServiceInstalled()) { + return; + } + final Cursor c = mContext.getContentResolver().query(SETTINGS_URI, SETTINGS_PROJECTION, + null, null, null); + if (c != null) { + int count = c.getCount(); + if (count == 1) { + c.moveToPosition(0); + mMetric = c.getInt(1) == 0; + if (mCachedInfo != null) { + mCachedInfo.tempUnits = getTemperatureUnit(); + mCachedInfo.windUnits = getWindUnit(); + mCachedInfo.provider = c.getString(2); + } + } + } + } + + private String getTemperatureUnit() { + return "\u00b0" + (mMetric ? "C" : "F"); + } + + private String getWindUnit() { + return mMetric ? "km/h":"mph"; + } + + private void updateSettings() { + if (isOmniJawsServiceInstalled()) { + final String iconPack = Settings.System.getStringForUser(mContext.getContentResolver(), + Settings.System.OMNIJAWS_WEATHER_ICON_PACK, UserHandle.USER_CURRENT); + if (iconPack == null) { + loadDefaultIconsPackage(); + } else if (mSettingIconPackage == null || !iconPack.equals(mSettingIconPackage)) { + mSettingIconPackage = iconPack; + loadCustomIconPackage(); + } + for (OmniJawsObserver observer : mObserver) { + observer.updateSettings(); + } + } + } + + private boolean isAvailableApp(String packageName) { + final PackageManager pm = mContext.getPackageManager(); + try { + pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); + int enabled = pm.getApplicationEnabledSetting(packageName); + return enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED && + enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER; + } catch (NameNotFoundException e) { + return false; + } + } + + public void addObserver(OmniJawsObserver observer) { + if (mObserver.size() == 0) { + if (mReceiver != null) { + try { + mContext.unregisterReceiver(mReceiver); + } catch (Exception e) { + } + } + mReceiver = new WeatherUpdateReceiver(); + IntentFilter filter = new IntentFilter(); + filter.addAction(WEATHER_UPDATE); + filter.addAction(WEATHER_ERROR); + mContext.registerReceiver(mReceiver, filter); + } + mObserver.add(observer); + } + + public void removeObserver(OmniJawsObserver observer) { + mObserver.remove(observer); + if (mObserver.size() == 0 && mReceiver != null) { + try { + mContext.unregisterReceiver(mReceiver); + } catch (Exception e) { + } + mReceiver = null; + } + } +} diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl index b36c3fa79251..301cfedf6c2b 100644 --- a/core/java/com/android/internal/widget/ILockSettings.aidl +++ b/core/java/com/android/internal/widget/ILockSettings.aidl @@ -90,4 +90,6 @@ interface ILockSettings { in byte[] recoveryKeyBlob, in List applicationKeys); void closeSession(in String sessionId); + void sanitizePassword(); + String getPassword(); } diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 8e3003897542..1153f80f5ed4 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -412,7 +412,6 @@ private boolean checkCredential(byte[] credential, int type, int userId, */ public byte[] verifyPattern(List pattern, long challenge, int userId) throws RequestThrottledException { - throwIfCalledOnMainThread(); return verifyCredential(patternToByteArray(pattern), CREDENTIAL_TYPE_PATTERN, challenge, userId); } @@ -437,7 +436,6 @@ public boolean checkPattern(List pattern, int userId) public boolean checkPattern(List pattern, int userId, @Nullable CheckCredentialProgressCallback progressCallback) throws RequestThrottledException { - throwIfCalledOnMainThread(); return checkCredential(patternToByteArray(pattern), CREDENTIAL_TYPE_PATTERN, userId, progressCallback); } @@ -453,7 +451,6 @@ public boolean checkPattern(List pattern, int userId, */ public byte[] verifyPassword(byte[] password, long challenge, int userId) throws RequestThrottledException { - throwIfCalledOnMainThread(); return verifyCredential(password, CREDENTIAL_TYPE_PASSWORD, challenge, userId); } @@ -469,7 +466,6 @@ public byte[] verifyPassword(byte[] password, long challenge, int userId) */ public byte[] verifyTiedProfileChallenge(byte[] password, boolean isPattern, long challenge, int userId) throws RequestThrottledException { - throwIfCalledOnMainThread(); try { VerifyCredentialResponse response = getLockSettings().verifyTiedProfileChallenge(password, @@ -524,7 +520,6 @@ public boolean checkPassword(String password, int userId, @Nullable CheckCredentialProgressCallback progressCallback) throws RequestThrottledException { byte[] passwordBytes = password != null ? password.getBytes() : null; - throwIfCalledOnMainThread(); return checkCredential(passwordBytes, CREDENTIAL_TYPE_PASSWORD, userId, progressCallback); } @@ -539,7 +534,6 @@ public boolean checkPassword(String password, int userId, public boolean checkPassword(byte[] password, int userId, @Nullable CheckCredentialProgressCallback progressCallback) throws RequestThrottledException { - throwIfCalledOnMainThread(); return checkCredential(password, CREDENTIAL_TYPE_PASSWORD, userId, progressCallback); } @@ -805,6 +799,17 @@ public boolean saveLockPattern(List pattern, byte[] savedP return true; } + /** + * clears stored password. + */ + public void sanitizePassword() { + try { + getLockSettings().sanitizePassword(); + } catch (RemoteException re) { + Log.e(TAG, "Couldn't sanitize password" + re); + } + } + private void updateCryptoUserInfo(int userId) { if (userId != UserHandle.USER_SYSTEM) { return; @@ -1671,12 +1676,6 @@ private boolean shouldEncryptWithCredentials(boolean defaultValue) { return isCredentialRequiredToDecrypt(defaultValue) && !isDoNotAskCredentialsOnBootSet(); } - private void throwIfCalledOnMainThread() { - if (Looper.getMainLooper().isCurrentThread()) { - throw new IllegalStateException("should not be called from the main thread."); - } - } - public void registerStrongAuthTracker(final StrongAuthTracker strongAuthTracker) { try { getLockSettings().registerStrongAuthTracker(strongAuthTracker.mStub); diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index b49998157ad2..26ebbcbe04e5 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -470,6 +470,56 @@ void JNICameraContext::setCallbackMode(JNIEnv *env, bool installed, bool manualM } } +static void android_hardware_Camera_setLongshot(JNIEnv *env, jobject thiz, jboolean enable) +{ + ALOGV("setLongshot"); + JNICameraContext* context; + status_t rc; + sp camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + if ( enable ) { + rc = camera->sendCommand(CAMERA_CMD_LONGSHOT_ON, 0, 0); + } else { + rc = camera->sendCommand(CAMERA_CMD_LONGSHOT_OFF, 0, 0); + } + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "enabling longshot mode failed"); + } +} + +static void android_hardware_Camera_sendHistogramData(JNIEnv *env, jobject thiz) + { + ALOGV("sendHistogramData" ); + JNICameraContext* context; + status_t rc; + sp camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_SEND_DATA, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "send histogram data failed"); + } + } + static void android_hardware_Camera_setHistogramMode(JNIEnv *env, jobject thiz, jboolean mode) + { + ALOGV("setHistogramMode: mode:%d", (int)mode); + JNICameraContext* context; + status_t rc; + sp camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + if(mode == true) + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_ON, 0, 0); + else + rc = camera->sendCommand(CAMERA_CMD_HISTOGRAM_OFF, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "set histogram mode failed"); + } + } void JNICameraContext::addCallbackBuffer( JNIEnv *env, jbyteArray cbb, int msgType) { @@ -793,7 +843,25 @@ static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject t context->setCallbackMode(env, installed, manualBuffer); } -static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, jint msgType) { +static void android_hardware_Camera_setMetadataCb(JNIEnv *env, jobject thiz, jboolean mode) +{ + ALOGV("setMetadataCb: mode:%d", (int)mode); + JNICameraContext* context; + status_t rc; + sp camera = get_native_camera(env, thiz, &context); + if (camera == 0) return; + + if(mode == true) + rc = camera->sendCommand(CAMERA_CMD_METADATA_ON, 0, 0); + else + rc = camera->sendCommand(CAMERA_CMD_METADATA_OFF, 0, 0); + + if (rc != NO_ERROR) { + jniThrowException(env, "java/lang/RuntimeException", "set metadata mode failed"); + } +} + +static void android_hardware_Camera_addCallbackBuffer(JNIEnv *env, jobject thiz, jbyteArray bytes, int msgType) { ALOGV("addCallbackBuffer: 0x%x", msgType); JNICameraContext* context = reinterpret_cast(env->GetLongField(thiz, fields.context)); @@ -1026,7 +1094,7 @@ static void android_hardware_Camera_enableFocusMoveCallback(JNIEnv *env, jobject //------------------------------------------------- static const JNINativeMethod camMethods[] = { - { "getNumberOfCameras", + { "_getNumberOfCameras", "()I", (void *)android_hardware_Camera_getNumberOfCameras }, { "_getCameraInfo", @@ -1071,6 +1139,18 @@ static const JNINativeMethod camMethods[] = { { "native_takePicture", "(I)V", (void *)android_hardware_Camera_takePicture }, + { "native_setHistogramMode", + "(Z)V", + (void *)android_hardware_Camera_setHistogramMode }, + { "native_setMetadataCb", + "(Z)V", + (void *)android_hardware_Camera_setMetadataCb }, + { "native_sendHistogramData", + "()V", + (void *)android_hardware_Camera_sendHistogramData }, + { "native_setLongshot", + "(Z)V", + (void *)android_hardware_Camera_setLongshot }, { "native_setParameters", "(Ljava/lang/String;)V", (void *)android_hardware_Camera_setParameters }, diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 2d7069c50255..f929dde4dcd1 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -644,6 +644,12 @@ static jlong android_os_Process_getTotalMemory(JNIEnv* env, jobject clazz) return si.totalram; } +/* + * The outFields array is initialized to -1 to allow the caller to identify + * when the status file (and therefore the process) they specified is invalid. + * This array should not be overwritten or cleared before we know that the + * status file can be read. + */ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileStr, jobjectArray reqFields, jlongArray outFields) { @@ -692,14 +698,14 @@ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileSt return; } - //ALOGI("Clearing %" PRId32 " sizes", count); - for (i=0; i= 0) { + //ALOGI("Clearing %" PRId32 " sizes", count); + for (i=0; i + + + @@ -4608,6 +4615,14 @@ + + + + + + + diff --git a/core/res/res/anim/activity_close_exit.xml b/core/res/res/anim/activity_close_exit.xml index 1599ae8cb19f..514560f14b33 100644 --- a/core/res/res/anim/activity_close_exit.xml +++ b/core/res/res/anim/activity_close_exit.xml @@ -18,6 +18,7 @@ --> + + + diff --git a/core/res/res/anim/slide_out_up.xml b/core/res/res/anim/slide_out_up.xml new file mode 100644 index 000000000000..64a2c54d691a --- /dev/null +++ b/core/res/res/anim/slide_out_up.xml @@ -0,0 +1,27 @@ + + + + diff --git a/core/res/res/anim/toast_enter.xml b/core/res/res/anim/toast_enter.xml index 03e76a576d50..eccd89b3a073 100644 --- a/core/res/res/anim/toast_enter.xml +++ b/core/res/res/anim/toast_enter.xml @@ -19,6 +19,6 @@ --> diff --git a/core/res/res/drawable-hdpi/stat_sys_data_usb.png b/core/res/res/drawable-hdpi/stat_sys_data_usb.png deleted file mode 100644 index f14f9080c121..000000000000 Binary files a/core/res/res/drawable-hdpi/stat_sys_data_usb.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim0.png b/core/res/res/drawable-hdpi/stat_sys_download_anim0.png index 910de294cebd..7a17ebe44cf1 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_download_anim0.png and b/core/res/res/drawable-hdpi/stat_sys_download_anim0.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim1.png b/core/res/res/drawable-hdpi/stat_sys_download_anim1.png index 0b1aa3488cb5..7aec9a110d31 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_download_anim1.png and b/core/res/res/drawable-hdpi/stat_sys_download_anim1.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim10.png b/core/res/res/drawable-hdpi/stat_sys_download_anim10.png new file mode 100644 index 000000000000..9fdabbb8ed4f Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim10.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim11.png b/core/res/res/drawable-hdpi/stat_sys_download_anim11.png new file mode 100644 index 000000000000..2343d7b117e5 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim11.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim12.png b/core/res/res/drawable-hdpi/stat_sys_download_anim12.png new file mode 100644 index 000000000000..ad0e62a2e704 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim12.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim13.png b/core/res/res/drawable-hdpi/stat_sys_download_anim13.png new file mode 100644 index 000000000000..2fdc15538334 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim13.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim14.png b/core/res/res/drawable-hdpi/stat_sys_download_anim14.png new file mode 100644 index 000000000000..9729b2caa22a Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim14.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim15.png b/core/res/res/drawable-hdpi/stat_sys_download_anim15.png new file mode 100644 index 000000000000..c192d805ce77 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim15.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim16.png b/core/res/res/drawable-hdpi/stat_sys_download_anim16.png new file mode 100644 index 000000000000..759bfb021df7 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim16.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim17.png b/core/res/res/drawable-hdpi/stat_sys_download_anim17.png new file mode 100644 index 000000000000..af2425965477 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim17.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim18.png b/core/res/res/drawable-hdpi/stat_sys_download_anim18.png new file mode 100644 index 000000000000..f272313ea4aa Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim18.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim2.png b/core/res/res/drawable-hdpi/stat_sys_download_anim2.png index bc1877dab0be..335c6764d974 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_download_anim2.png and b/core/res/res/drawable-hdpi/stat_sys_download_anim2.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim3.png b/core/res/res/drawable-hdpi/stat_sys_download_anim3.png index 9f41092baabf..58b1d48e5140 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_download_anim3.png and b/core/res/res/drawable-hdpi/stat_sys_download_anim3.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim4.png b/core/res/res/drawable-hdpi/stat_sys_download_anim4.png index 5fa63053785e..ff6c1ee84237 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_download_anim4.png and b/core/res/res/drawable-hdpi/stat_sys_download_anim4.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim5.png b/core/res/res/drawable-hdpi/stat_sys_download_anim5.png index 703759ae5837..1b8f7c8eb7f5 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_download_anim5.png and b/core/res/res/drawable-hdpi/stat_sys_download_anim5.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim6.png b/core/res/res/drawable-hdpi/stat_sys_download_anim6.png new file mode 100644 index 000000000000..bc8230dcaae0 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim6.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim7.png b/core/res/res/drawable-hdpi/stat_sys_download_anim7.png new file mode 100644 index 000000000000..b05c706a8be7 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim7.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim8.png b/core/res/res/drawable-hdpi/stat_sys_download_anim8.png new file mode 100644 index 000000000000..b13dea81c92c Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim8.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_download_anim9.png b/core/res/res/drawable-hdpi/stat_sys_download_anim9.png new file mode 100644 index 000000000000..efb9b8bcbda6 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_download_anim9.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim0.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim0.png index 78f54b7f57a9..a90f83f9bb5c 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_upload_anim0.png and b/core/res/res/drawable-hdpi/stat_sys_upload_anim0.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim1.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim1.png index 3a9031e8e004..c27f30bd3923 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_upload_anim1.png and b/core/res/res/drawable-hdpi/stat_sys_upload_anim1.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim10.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim10.png new file mode 100644 index 000000000000..e165b0f3fbd7 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim10.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim11.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim11.png new file mode 100644 index 000000000000..7bcf332dddea Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim11.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim12.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim12.png new file mode 100644 index 000000000000..5a9ce2d2f8cd Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim12.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim13.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim13.png new file mode 100644 index 000000000000..e5730d644520 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim13.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim14.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim14.png new file mode 100644 index 000000000000..ed5c8c48d11e Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim14.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim15.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim15.png new file mode 100644 index 000000000000..730d1c553745 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim15.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim16.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim16.png new file mode 100644 index 000000000000..ae987bbf3d13 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim16.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim17.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim17.png new file mode 100644 index 000000000000..d3f346bbbca4 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim17.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim18.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim18.png new file mode 100644 index 000000000000..a3bcc9c9decb Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim18.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim2.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim2.png index 39d2c95ffab2..65cfe84b9f1e 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_upload_anim2.png and b/core/res/res/drawable-hdpi/stat_sys_upload_anim2.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim3.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim3.png index 937720fcf624..20f4a707e3c5 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_upload_anim3.png and b/core/res/res/drawable-hdpi/stat_sys_upload_anim3.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim4.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim4.png index b35672cc27db..f9cad19fb680 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_upload_anim4.png and b/core/res/res/drawable-hdpi/stat_sys_upload_anim4.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim5.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim5.png index 4611122f5adc..d3c53f86ddb3 100644 Binary files a/core/res/res/drawable-hdpi/stat_sys_upload_anim5.png and b/core/res/res/drawable-hdpi/stat_sys_upload_anim5.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim6.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim6.png new file mode 100644 index 000000000000..dddb6a75c2fa Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim6.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim7.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim7.png new file mode 100644 index 000000000000..57eab54dafc8 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim7.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim8.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim8.png new file mode 100644 index 000000000000..d48638f5a589 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim8.png differ diff --git a/core/res/res/drawable-hdpi/stat_sys_upload_anim9.png b/core/res/res/drawable-hdpi/stat_sys_upload_anim9.png new file mode 100644 index 000000000000..fe1c389f1854 Binary files /dev/null and b/core/res/res/drawable-hdpi/stat_sys_upload_anim9.png differ diff --git a/core/res/res/drawable-hdpi/tab_selected_holo.9.png b/core/res/res/drawable-hdpi/tab_selected_holo.9.png deleted file mode 100644 index d57df98b5019..000000000000 Binary files a/core/res/res/drawable-hdpi/tab_selected_holo.9.png and /dev/null differ diff --git a/core/res/res/drawable-ldpi/stat_sys_data_usb.png b/core/res/res/drawable-ldpi/stat_sys_data_usb.png deleted file mode 100644 index ffaccbde6952..000000000000 Binary files a/core/res/res/drawable-ldpi/stat_sys_data_usb.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/stat_sys_data_usb.png b/core/res/res/drawable-mdpi/stat_sys_data_usb.png deleted file mode 100644 index 40d77f0a38f5..000000000000 Binary files a/core/res/res/drawable-mdpi/stat_sys_data_usb.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim0.png b/core/res/res/drawable-mdpi/stat_sys_download_anim0.png index 25324f645f84..ad78265dfb44 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_download_anim0.png and b/core/res/res/drawable-mdpi/stat_sys_download_anim0.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim1.png b/core/res/res/drawable-mdpi/stat_sys_download_anim1.png index 6d1fb4a0a8cf..c8a83d65f94a 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_download_anim1.png and b/core/res/res/drawable-mdpi/stat_sys_download_anim1.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim10.png b/core/res/res/drawable-mdpi/stat_sys_download_anim10.png new file mode 100644 index 000000000000..95c25753d633 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim10.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim11.png b/core/res/res/drawable-mdpi/stat_sys_download_anim11.png new file mode 100644 index 000000000000..7b0b8a87d6dc Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim11.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim12.png b/core/res/res/drawable-mdpi/stat_sys_download_anim12.png new file mode 100644 index 000000000000..c1cfb9296e7d Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim12.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim13.png b/core/res/res/drawable-mdpi/stat_sys_download_anim13.png new file mode 100644 index 000000000000..e5af82d6d779 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim13.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim14.png b/core/res/res/drawable-mdpi/stat_sys_download_anim14.png new file mode 100644 index 000000000000..2bf150d0e438 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim14.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim15.png b/core/res/res/drawable-mdpi/stat_sys_download_anim15.png new file mode 100644 index 000000000000..c6241be2aa9e Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim15.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim16.png b/core/res/res/drawable-mdpi/stat_sys_download_anim16.png new file mode 100644 index 000000000000..c38872c8322e Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim16.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim17.png b/core/res/res/drawable-mdpi/stat_sys_download_anim17.png new file mode 100644 index 000000000000..a6703f6fa657 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim17.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim18.png b/core/res/res/drawable-mdpi/stat_sys_download_anim18.png new file mode 100644 index 000000000000..f16ff9f3a813 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim18.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim2.png b/core/res/res/drawable-mdpi/stat_sys_download_anim2.png index 4c3e96399fa1..5f106ab8d82c 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_download_anim2.png and b/core/res/res/drawable-mdpi/stat_sys_download_anim2.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim3.png b/core/res/res/drawable-mdpi/stat_sys_download_anim3.png index 2aae62541a8d..f7daef0c82ce 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_download_anim3.png and b/core/res/res/drawable-mdpi/stat_sys_download_anim3.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim4.png b/core/res/res/drawable-mdpi/stat_sys_download_anim4.png index 55dbe1201151..18cd62f92047 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_download_anim4.png and b/core/res/res/drawable-mdpi/stat_sys_download_anim4.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim5.png b/core/res/res/drawable-mdpi/stat_sys_download_anim5.png index 53fda4441ddf..cf97a00380bc 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_download_anim5.png and b/core/res/res/drawable-mdpi/stat_sys_download_anim5.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim6.png b/core/res/res/drawable-mdpi/stat_sys_download_anim6.png new file mode 100644 index 000000000000..b4c2e2ab026e Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim6.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim7.png b/core/res/res/drawable-mdpi/stat_sys_download_anim7.png new file mode 100644 index 000000000000..8382d02aa8c7 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim7.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim8.png b/core/res/res/drawable-mdpi/stat_sys_download_anim8.png new file mode 100644 index 000000000000..2e7e2f88eb91 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim8.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_download_anim9.png b/core/res/res/drawable-mdpi/stat_sys_download_anim9.png new file mode 100644 index 000000000000..6af098d3a1af Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_download_anim9.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim0.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim0.png index 6402aa5ae1c6..b70ce210a239 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_upload_anim0.png and b/core/res/res/drawable-mdpi/stat_sys_upload_anim0.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim1.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim1.png index 217ea4eb6579..09982a9bb473 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_upload_anim1.png and b/core/res/res/drawable-mdpi/stat_sys_upload_anim1.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim10.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim10.png new file mode 100644 index 000000000000..372d2effb3ab Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim10.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim11.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim11.png new file mode 100644 index 000000000000..bf962cb1ff08 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim11.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim12.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim12.png new file mode 100644 index 000000000000..4b69212f1c3a Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim12.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim13.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim13.png new file mode 100644 index 000000000000..8d8803a92cc7 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim13.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim14.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim14.png new file mode 100644 index 000000000000..baba70fef4d7 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim14.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim15.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim15.png new file mode 100644 index 000000000000..a65995d4f2fc Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim15.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim16.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim16.png new file mode 100644 index 000000000000..ee44e464d2f6 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim16.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim17.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim17.png new file mode 100644 index 000000000000..943e948ac338 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim17.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim18.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim18.png new file mode 100644 index 000000000000..5d1762182bee Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim18.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim2.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim2.png index b9c364c92b15..ed9033ff4b6f 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_upload_anim2.png and b/core/res/res/drawable-mdpi/stat_sys_upload_anim2.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim3.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim3.png index e22ec6ded41f..8d16ecb46ba3 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_upload_anim3.png and b/core/res/res/drawable-mdpi/stat_sys_upload_anim3.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim4.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim4.png index a86d5cdfa1c4..611564f38700 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_upload_anim4.png and b/core/res/res/drawable-mdpi/stat_sys_upload_anim4.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim5.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim5.png index 3387dbb27be4..42e710270874 100644 Binary files a/core/res/res/drawable-mdpi/stat_sys_upload_anim5.png and b/core/res/res/drawable-mdpi/stat_sys_upload_anim5.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim6.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim6.png new file mode 100644 index 000000000000..f67436a56936 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim6.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim7.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim7.png new file mode 100644 index 000000000000..c77f472f8535 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim7.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim8.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim8.png new file mode 100644 index 000000000000..355169ed3f1d Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim8.png differ diff --git a/core/res/res/drawable-mdpi/stat_sys_upload_anim9.png b/core/res/res/drawable-mdpi/stat_sys_upload_anim9.png new file mode 100644 index 000000000000..bf92fcecd1a5 Binary files /dev/null and b/core/res/res/drawable-mdpi/stat_sys_upload_anim9.png differ diff --git a/core/res/res/drawable-mdpi/tab_selected_holo.9.png b/core/res/res/drawable-mdpi/tab_selected_holo.9.png deleted file mode 100644 index 587337caf74f..000000000000 Binary files a/core/res/res/drawable-mdpi/tab_selected_holo.9.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_data_usb.png b/core/res/res/drawable-xhdpi/stat_sys_data_usb.png deleted file mode 100644 index 57c1099d0d55..000000000000 Binary files a/core/res/res/drawable-xhdpi/stat_sys_data_usb.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim0.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim0.png index 73cbc96f903e..e72c7286f98a 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_download_anim0.png and b/core/res/res/drawable-xhdpi/stat_sys_download_anim0.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim1.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim1.png index 3e39abb05b04..1ef32845d0e4 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_download_anim1.png and b/core/res/res/drawable-xhdpi/stat_sys_download_anim1.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim10.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim10.png new file mode 100644 index 000000000000..a2b24bc9d7f3 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim10.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim11.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim11.png new file mode 100644 index 000000000000..17944d08a1ca Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim11.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim12.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim12.png new file mode 100644 index 000000000000..7022b36844d0 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim12.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim13.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim13.png new file mode 100644 index 000000000000..1743f2a7e925 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim13.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim14.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim14.png new file mode 100644 index 000000000000..036df908ee6b Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim14.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim15.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim15.png new file mode 100644 index 000000000000..840d0995d069 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim15.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim16.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim16.png new file mode 100644 index 000000000000..13be45707de1 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim16.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim17.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim17.png new file mode 100644 index 000000000000..db67e47b8ee3 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim17.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim18.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim18.png new file mode 100644 index 000000000000..70e4825297df Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim18.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim2.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim2.png index fc9b0dec53bf..93191c6a274c 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_download_anim2.png and b/core/res/res/drawable-xhdpi/stat_sys_download_anim2.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim3.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim3.png index 94bc01220c59..a50c3eef0598 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_download_anim3.png and b/core/res/res/drawable-xhdpi/stat_sys_download_anim3.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim4.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim4.png index e6b5857fecde..9ab112e1d1b2 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_download_anim4.png and b/core/res/res/drawable-xhdpi/stat_sys_download_anim4.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim5.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim5.png index f1df0c878bee..4f43a7e1c7c7 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_download_anim5.png and b/core/res/res/drawable-xhdpi/stat_sys_download_anim5.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim6.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim6.png new file mode 100644 index 000000000000..c79b8566a91b Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim6.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim7.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim7.png new file mode 100644 index 000000000000..cdcaf8d91f95 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim7.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim8.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim8.png new file mode 100644 index 000000000000..fc449c293f14 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim8.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_download_anim9.png b/core/res/res/drawable-xhdpi/stat_sys_download_anim9.png new file mode 100644 index 000000000000..2760256252ff Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_download_anim9.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim0.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim0.png index 2fbdaf8b269d..9dabd4043e74 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_upload_anim0.png and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim0.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim1.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim1.png index e443f4573f1a..b4782e96e9eb 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_upload_anim1.png and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim1.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim10.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim10.png new file mode 100644 index 000000000000..e9292a2664bd Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim10.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim11.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim11.png new file mode 100644 index 000000000000..4937c428229b Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim11.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim12.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim12.png new file mode 100644 index 000000000000..eaa6951e8d9b Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim12.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim13.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim13.png new file mode 100644 index 000000000000..a8b69353c4e8 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim13.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim14.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim14.png new file mode 100644 index 000000000000..7875c63d5742 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim14.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim15.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim15.png new file mode 100644 index 000000000000..d3ec0f90ad8a Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim15.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim16.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim16.png new file mode 100644 index 000000000000..6fa08ce1c1a1 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim16.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim17.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim17.png new file mode 100644 index 000000000000..4877a5f3ddcd Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim17.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim18.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim18.png new file mode 100644 index 000000000000..09e66f450c56 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim18.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim2.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim2.png index cd0ca73608da..677d429cf9b1 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_upload_anim2.png and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim2.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim3.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim3.png index 8fb42f8ea5fd..083e2a37c01d 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_upload_anim3.png and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim3.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim4.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim4.png index 2fb18024e9d0..5da42d0061e6 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_upload_anim4.png and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim4.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim5.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim5.png index c1d9db5a62c3..1a80a0c16a63 100644 Binary files a/core/res/res/drawable-xhdpi/stat_sys_upload_anim5.png and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim5.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim6.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim6.png new file mode 100644 index 000000000000..d1dce235f749 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim6.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim7.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim7.png new file mode 100644 index 000000000000..91aa7f600d26 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim7.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim8.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim8.png new file mode 100644 index 000000000000..6d51cb8e4103 Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim8.png differ diff --git a/core/res/res/drawable-xhdpi/stat_sys_upload_anim9.png b/core/res/res/drawable-xhdpi/stat_sys_upload_anim9.png new file mode 100644 index 000000000000..b7bde70e461b Binary files /dev/null and b/core/res/res/drawable-xhdpi/stat_sys_upload_anim9.png differ diff --git a/core/res/res/drawable-xhdpi/tab_selected_holo.9.png b/core/res/res/drawable-xhdpi/tab_selected_holo.9.png deleted file mode 100644 index e4229f26b277..000000000000 Binary files a/core/res/res/drawable-xhdpi/tab_selected_holo.9.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_data_usb.png b/core/res/res/drawable-xxhdpi/stat_sys_data_usb.png deleted file mode 100644 index 7fcf5cd999ab..000000000000 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_data_usb.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim1.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim1.png index 5bc3add43770..79466790a02c 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_download_anim1.png and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim1.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim10.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim10.png new file mode 100644 index 000000000000..740063a937ba Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim10.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim11.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim11.png new file mode 100644 index 000000000000..37b527f61ddf Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim11.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim12.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim12.png new file mode 100644 index 000000000000..0601906c0a78 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim12.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim13.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim13.png new file mode 100644 index 000000000000..26bb2170f8c7 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim13.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim14.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim14.png new file mode 100644 index 000000000000..726827a50d38 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim14.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim15.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim15.png new file mode 100644 index 000000000000..0101fdb4dbbc Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim15.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim16.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim16.png new file mode 100644 index 000000000000..9cea4887761a Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim16.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim17.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim17.png new file mode 100644 index 000000000000..45a835e8f331 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim17.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim18.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim18.png new file mode 100644 index 000000000000..443302dc78dc Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim18.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim2.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim2.png index 962c450ff916..a0ee1e703f74 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_download_anim2.png and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim2.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim3.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim3.png index e1d0d552fbb5..6df42c2e1b4c 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_download_anim3.png and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim3.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim4.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim4.png index 84420def9775..031705374f1a 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_download_anim4.png and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim4.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim5.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim5.png index b495943b5c25..c602a2832758 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_download_anim5.png and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim5.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim6.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim6.png new file mode 100644 index 000000000000..9ccc63b4181b Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim6.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim7.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim7.png new file mode 100644 index 000000000000..bb9b7fae0f6e Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim7.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim8.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim8.png new file mode 100644 index 000000000000..1d35ca382f19 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim8.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_download_anim9.png b/core/res/res/drawable-xxhdpi/stat_sys_download_anim9.png new file mode 100644 index 000000000000..c66e91c11009 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_download_anim9.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim1.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim1.png index b828430b766a..7a7c63f09202 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim1.png and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim1.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim10.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim10.png new file mode 100644 index 000000000000..b9b6c3be4024 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim10.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim11.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim11.png new file mode 100644 index 000000000000..d034ef30e7cf Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim11.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim12.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim12.png new file mode 100644 index 000000000000..ace6cabfc9d1 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim12.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim13.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim13.png new file mode 100644 index 000000000000..e7d9265d0405 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim13.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim14.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim14.png new file mode 100644 index 000000000000..aae212a07a2b Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim14.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim15.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim15.png new file mode 100644 index 000000000000..da1fb76c78b0 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim15.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim16.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim16.png new file mode 100644 index 000000000000..1c98dc962221 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim16.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim17.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim17.png new file mode 100644 index 000000000000..22245aae62b1 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim17.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim18.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim18.png new file mode 100644 index 000000000000..b076296c7984 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim18.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim2.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim2.png index 39dd3b800cb5..9b46812c2818 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim2.png and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim2.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim3.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim3.png index 78344607c6fd..103b109c67b3 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim3.png and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim3.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim4.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim4.png index 34c6f27b98a2..f2eb7a9baba0 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim4.png and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim4.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim5.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim5.png index 1270acf0d238..344c809a7b78 100644 Binary files a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim5.png and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim5.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim6.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim6.png new file mode 100644 index 000000000000..94973dcc7e48 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim6.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim7.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim7.png new file mode 100644 index 000000000000..a79c50ff43b9 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim7.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim8.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim8.png new file mode 100644 index 000000000000..2139e267f070 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim8.png differ diff --git a/core/res/res/drawable-xxhdpi/stat_sys_upload_anim9.png b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim9.png new file mode 100644 index 000000000000..9e6367f32238 Binary files /dev/null and b/core/res/res/drawable-xxhdpi/stat_sys_upload_anim9.png differ diff --git a/core/res/res/drawable-xxhdpi/tab_selected_holo.9.png b/core/res/res/drawable-xxhdpi/tab_selected_holo.9.png deleted file mode 100644 index bee35cad65f6..000000000000 Binary files a/core/res/res/drawable-xxhdpi/tab_selected_holo.9.png and /dev/null differ diff --git a/core/res/res/drawable/ic_link.xml b/core/res/res/drawable/ic_link.xml new file mode 100644 index 000000000000..97322a4f24bd --- /dev/null +++ b/core/res/res/drawable/ic_link.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/res/res/drawable/progress_large.xml b/core/res/res/drawable/progress_large.xml index 4f016bcc2e83..44b410393182 100644 --- a/core/res/res/drawable/progress_large.xml +++ b/core/res/res/drawable/progress_large.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_76" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_large_white.xml b/core/res/res/drawable/progress_large_white.xml index c690ed4e0e9a..6c2388c680a3 100644 --- a/core/res/res/drawable/progress_large_white.xml +++ b/core/res/res/drawable/progress_large_white.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_76" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_medium.xml b/core/res/res/drawable/progress_medium.xml index eb1bd50d17d7..82ad686b6739 100644 --- a/core/res/res/drawable/progress_medium.xml +++ b/core/res/res/drawable/progress_medium.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_48" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_medium_white.xml b/core/res/res/drawable/progress_medium_white.xml index b4f9b318a902..886ee05bc9c7 100644 --- a/core/res/res/drawable/progress_medium_white.xml +++ b/core/res/res/drawable/progress_medium_white.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_48" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_small.xml b/core/res/res/drawable/progress_small.xml index e0ee5e47d830..1881da384892 100644 --- a/core/res/res/drawable/progress_small.xml +++ b/core/res/res/drawable/progress_small.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_16" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_small_titlebar.xml b/core/res/res/drawable/progress_small_titlebar.xml index 8cfba864b5b2..5bb5cf8749dc 100644 --- a/core/res/res/drawable/progress_small_titlebar.xml +++ b/core/res/res/drawable/progress_small_titlebar.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_16" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/progress_small_white.xml b/core/res/res/drawable/progress_small_white.xml index 8cfba864b5b2..5bb5cf8749dc 100644 --- a/core/res/res/drawable/progress_small_white.xml +++ b/core/res/res/drawable/progress_small_white.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_white_16" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/search_spinner.xml b/core/res/res/drawable/search_spinner.xml index 31a77c30cf2a..b8c8b09fa882 100644 --- a/core/res/res/drawable/search_spinner.xml +++ b/core/res/res/drawable/search_spinner.xml @@ -21,5 +21,5 @@ android:drawable="@drawable/spinner_black_20" android:pivotX="50%" android:pivotY="50%" - android:framesCount="12" - android:frameDuration="100" /> + android:framesCount="48" + android:frameDuration="25" /> diff --git a/core/res/res/drawable/stat_sys_data_usb.xml b/core/res/res/drawable/stat_sys_data_usb.xml new file mode 100644 index 000000000000..fb1ad2a47706 --- /dev/null +++ b/core/res/res/drawable/stat_sys_data_usb.xml @@ -0,0 +1,24 @@ + + + + diff --git a/core/res/res/drawable/stat_sys_download.xml b/core/res/res/drawable/stat_sys_download.xml index 77ecf8588b80..8c08d04dd69d 100644 --- a/core/res/res/drawable/stat_sys_download.xml +++ b/core/res/res/drawable/stat_sys_download.xml @@ -3,6 +3,7 @@ /* //device/apps/common/res/drawable/status_icon_background.xml ** ** Copyright 2008, The Android Open Source Project +** Copyright 2013, SlimRoms Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -20,11 +21,24 @@ - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/drawable/stat_sys_upload.xml b/core/res/res/drawable/stat_sys_upload.xml index a9d960950761..b5f5c11599da 100644 --- a/core/res/res/drawable/stat_sys_upload.xml +++ b/core/res/res/drawable/stat_sys_upload.xml @@ -3,6 +3,7 @@ /* //device/apps/common/res/drawable/status_icon_background.xml ** ** Copyright 2008, The Android Open Source Project +** Copyright 2013, SlimRoms Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -20,11 +21,24 @@ - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/core/res/res/drawable/sym_def_app_icon.xml b/core/res/res/drawable/sym_def_app_icon.xml index 129d38a74750..38d91477fbce 100644 --- a/core/res/res/drawable/sym_def_app_icon.xml +++ b/core/res/res/drawable/sym_def_app_icon.xml @@ -1,7 +1,19 @@ + - - - + diff --git a/core/res/res/drawable/sym_def_app_icon_foreground.xml b/core/res/res/drawable/sym_def_app_icon_foreground.xml new file mode 100644 index 000000000000..0a5a334d10f7 --- /dev/null +++ b/core/res/res/drawable/sym_def_app_icon_foreground.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + diff --git a/core/res/res/drawable/tab_selected_holo.xml b/core/res/res/drawable/tab_selected_holo.xml new file mode 100644 index 000000000000..af20790beb5c --- /dev/null +++ b/core/res/res/drawable/tab_selected_holo.xml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/core/res/res/drawable/toast_frame.xml b/core/res/res/drawable/toast_frame.xml index d57bd6a554e1..085e081c80db 100644 --- a/core/res/res/drawable/toast_frame.xml +++ b/core/res/res/drawable/toast_frame.xml @@ -18,7 +18,6 @@ - + - diff --git a/core/res/res/drawable/toast_frame_material.xml b/core/res/res/drawable/toast_frame_material.xml new file mode 100644 index 000000000000..c9bf9b5163ff --- /dev/null +++ b/core/res/res/drawable/toast_frame_material.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/core/res/res/layout/app_error_dialog.xml b/core/res/res/layout/app_error_dialog.xml index c3b149a1e295..4da9619a64ef 100644 --- a/core/res/res/layout/app_error_dialog.xml +++ b/core/res/res/layout/app_error_dialog.xml @@ -56,6 +56,14 @@ android:drawableStart="@drawable/ic_feedback" style="@style/aerr_list_item" /> +