diff --git a/Android.bp b/Android.bp index 7e043fcf5b6e..c58dac187004 100644 --- a/Android.bp +++ b/Android.bp @@ -279,6 +279,8 @@ java_defaults { "core/java/android/os/storage/IStorageShutdownObserver.aidl", "core/java/android/os/storage/IObbActionListener.aidl", "core/java/android/permission/IPermissionController.aidl", + "core/java/android/pocket/IPocketService.aidl", + "core/java/android/pocket/IPocketCallback.aidl", ":keystore_aidl", "core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl", "core/java/android/service/appprediction/IPredictionService.aidl", diff --git a/CleanSpec.mk b/CleanSpec.mk index f311fc81fc10..eca648e4a2e4 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -78,6 +78,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/libhwui.so) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libhwui.so) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/os/storage/*) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/IClipboard.P) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/pocket/*) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/ITelephonyRegistry.P) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/docs/api-stubs*) 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..4385f14ca5b9 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -159,6 +159,8 @@ import android.os.storage.StorageManager; import android.permission.PermissionControllerManager; import android.permission.PermissionManager; +import android.pocket.IPocketService; +import android.pocket.PocketManager; import android.print.IPrintManager; import android.print.PrintManager; import android.service.oemlock.IOemLockService; @@ -944,20 +946,23 @@ 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); } }); + registerService(Context.POCKET_SERVICE, PocketManager.class, + new CachedServiceFetcher() { + @Override + public PocketManager createService(ContextImpl ctx) { + IBinder binder = ServiceManager.getService(Context.POCKET_SERVICE); + IPocketService service = IPocketService.Stub.asInterface(binder); + return new PocketManager(ctx.getOuterContext(), service); + }}); + registerService(Context.TV_INPUT_SERVICE, TvInputManager.class, new CachedServiceFetcher() { @Override 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/Context.java b/core/java/android/content/Context.java index 414cc39f5310..93ddd063134a 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -4685,6 +4685,16 @@ public abstract boolean startInstrumentation(@NonNull ComponentName className, */ public static final String DYNAMIC_SYSTEM_SERVICE = "dynamic_system"; + /** + * Use with {@link #getSystemService} to retrieve a + * {@link android.os.PocketManager} for accessing and listening to device pocket state. + * + * @hide + * @see #getSystemService + * @see android.os.PocketManager + */ + public static final String POCKET_SERVICE = "pocket"; + /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. 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/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java index e5ef67b7d4bd..2420a6109155 100644 --- a/core/java/android/content/res/AssetManager.java +++ b/core/java/android/content/res/AssetManager.java @@ -1157,8 +1157,11 @@ protected void finalize() throws Throwable { } } - if (mObject != 0) { - nativeDestroy(mObject); + synchronized (this) { + if (mObject != 0) { + nativeDestroy(mObject); + mObject = 0; + } } } diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index c6e175d2a881..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; @@ -292,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. @@ -303,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); @@ -547,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) { @@ -575,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) { @@ -3896,6 +3943,7 @@ public String getSceneMode() { * @see #getSceneMode() */ public void setSceneMode(String value) { + if(getSupportedSceneModes() == null) return; set(KEY_SCENE_MODE, value); } @@ -3933,6 +3981,7 @@ public String getFlashMode() { * @see #getFlashMode() */ public void setFlashMode(String value) { + if(getSupportedFlashModes() == null) return; set(KEY_FLASH_MODE, value); } 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/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java index 12b285a0f0ab..af474910f7e8 100644 --- a/core/java/android/hardware/face/FaceManager.java +++ b/core/java/android/hardware/face/FaceManager.java @@ -244,6 +244,59 @@ public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSi } } + /** + * Request face authentication enrollment. This call operates the face authentication hardware + * and starts capturing images. Progress will be indicated by callbacks to the + * {@link EnrollmentCallback} object. It terminates when + * {@link EnrollmentCallback#onEnrollmentError(int, CharSequence)} or + * {@link EnrollmentCallback#onEnrollmentProgress(int) is called with remaining == 0, at + * which point the object is no longer valid. The operation can be canceled by using the + * provided cancel object. + * + * @param token a unique token provided by a recent creation or verification of device + * credentials (e.g. pin, pattern or password). + * @param cancel an object that can be used to cancel enrollment + * @param flags optional flags + * @param callback an object to receive enrollment events + * @hide + */ + @RequiresPermission(MANAGE_BIOMETRIC) + public void enroll(byte[] token, CancellationSignal cancel, + EnrollmentCallback callback, int[] disabledFeatures) { + if (callback == null) { + throw new IllegalArgumentException("Must supply an enrollment callback"); + } + + if (cancel != null) { + if (cancel.isCanceled()) { + Log.w(TAG, "enrollment already canceled"); + return; + } else { + cancel.setOnCancelListener(new OnEnrollCancelListener()); + } + } + + if (mService != null) { + try { + mEnrollmentCallback = callback; + Trace.beginSection("FaceManager#enroll"); + mService.enrollMoto(mToken, token, mServiceReceiver, + mContext.getOpPackageName(), disabledFeatures); + } catch (RemoteException e) { + Log.w(TAG, "Remote exception in enroll: ", e); + if (callback != null) { + // Though this may not be a hardware issue, it will cause apps to give up or + // try again later. + callback.onEnrollmentError(FACE_ERROR_HW_UNAVAILABLE, + getErrorString(mContext, FACE_ERROR_HW_UNAVAILABLE, + 0 /* vendorCode */)); + } + } finally { + Trace.endSection(); + } + } + } + /** * Request face authentication enrollment. This call operates the face authentication hardware * and starts capturing images. Progress will be indicated by callbacks to the diff --git a/core/java/android/hardware/face/IFaceService.aidl b/core/java/android/hardware/face/IFaceService.aidl index b6a0afbf716c..9aa34d4738d7 100644 --- a/core/java/android/hardware/face/IFaceService.aidl +++ b/core/java/android/hardware/face/IFaceService.aidl @@ -105,4 +105,9 @@ interface IFaceService { void getFeature(int userId, int feature, IFaceServiceReceiver receiver, String opPackageName); void userActivity(); + + // Moto additions + // Start face enrollment + void enrollMoto(IBinder token, in byte [] cryptoToken, IFaceServiceReceiver receiver, + String opPackageName, in int [] disabledFeatures); } 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 0061d97736bf..31403773aff3 100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -1082,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"); @@ -1091,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/ExternalVibration.java b/core/java/android/os/ExternalVibration.java index 37ca868598f5..041d21fabd6f 100644 --- a/core/java/android/os/ExternalVibration.java +++ b/core/java/android/os/ExternalVibration.java @@ -157,7 +157,6 @@ public void writeToParcel(Parcel out, int flags) { out.writeInt(mUid); out.writeString(mPkg); writeAudioAttributes(mAttrs, out, flags); - out.writeParcelable(mAttrs, flags); out.writeStrongBinder(mController.asBinder()); out.writeStrongBinder(mToken); } diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 3b574913fb39..3d173335b39d 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -64,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 95cbe65728c6..755dd96af9eb 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -528,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. @@ -1388,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/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/pocket/IPocketCallback.aidl b/core/java/android/pocket/IPocketCallback.aidl new file mode 100644 index 000000000000..53e5412f89be --- /dev/null +++ b/core/java/android/pocket/IPocketCallback.aidl @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2016 The ParanoidAndroid Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.pocket; + +/** @hide */ +interface IPocketCallback { + + // notify when pocket state changes. + void onStateChanged(boolean isDeviceInPocket, int reason); + +} \ No newline at end of file diff --git a/core/java/android/pocket/IPocketService.aidl b/core/java/android/pocket/IPocketService.aidl new file mode 100644 index 000000000000..783465774207 --- /dev/null +++ b/core/java/android/pocket/IPocketService.aidl @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2016 The ParanoidAndroid Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.pocket; + +import android.pocket.IPocketCallback; + +/** @hide */ +interface IPocketService { + + // add callback to get notified about pocket state. + void addCallback(IPocketCallback callback); + + // remove callback and stop getting notified about pocket state. + void removeCallback(IPocketCallback callback); + + // notify pocket service about intercative state changed. + // @see com.android.policy.PhoneWindowManager + void onInteractiveChanged(boolean interactive); + + // external processes can request changing listening state. + void setListeningExternal(boolean listen); + + // check if device is in pocket. + boolean isDeviceInPocket(); + + // Custom methods + void setPocketLockVisible(boolean visible); + boolean isPocketLockVisible(); + +} \ No newline at end of file diff --git a/core/java/android/pocket/PocketConstants.java b/core/java/android/pocket/PocketConstants.java new file mode 100644 index 000000000000..f0d08a272375 --- /dev/null +++ b/core/java/android/pocket/PocketConstants.java @@ -0,0 +1,25 @@ +package android.pocket; + +/** + * This class contains global pocket setup constants. + * @author Carlo Savignano + * @hide + */ + +public class PocketConstants { + + public static final boolean DEBUG = false; + public static final boolean DEBUG_SPEW = false; + + /** + * Whether to use proximity sensor to evaluate pocket state. + */ + public static final boolean ENABLE_PROXIMITY_JUDGE = true; + + /** + * Whether to use light sensor to evaluate pocket state. + */ + public static final boolean ENABLE_LIGHT_JUDGE = true; + + +} diff --git a/core/java/android/pocket/PocketManager.java b/core/java/android/pocket/PocketManager.java new file mode 100644 index 000000000000..22b60696289b --- /dev/null +++ b/core/java/android/pocket/PocketManager.java @@ -0,0 +1,233 @@ +/** + * Copyright (C) 2016 The ParanoidAndroid Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.pocket; + +import android.content.Context; +import android.os.Handler; +import android.os.PowerManager; +import android.os.RemoteException; +import android.os.SystemClock; +import android.text.format.DateUtils; +import android.util.Log; +import android.util.Slog; + +/** + * A class that coordinates listening for pocket state. + *

+ * Use {@link android.content.Context#getSystemService(java.lang.String)} + * with argument {@link android.content.Context#POCKET_SERVICE} to get + * an instance of this class. + * + * Usage: import and create a final {@link IPocketCallback.Stub()} and implement your logic in + * {@link IPocketCallback#onStateChanged(boolean, int)}. Then add your callback to the pocket manager + * + * // define a final callback + * private final IPocketCallback mCallback = new IPocketCallback.Stub() { + * + * @Override + * public void onStateChanged(boolean isDeviceInPocket, int reason) { + * // Your method to handle logic outside of this callback, ideally with a handler + * // posting on UI Thread for view hierarchy operations or with its own background thread. + * handlePocketStateChanged(isDeviceInPocket, reason); + * } + * + * } + * + * // add callback to pocket manager + * private void addCallback() { + * PocketManager manager = (PocketManager) context.getSystemService(Context.POCKET_SERVICE); + * manager.addCallback(mCallback); + * } + * + * @author Carlo Savignano + * @hide + */ +public class PocketManager { + + private static final String TAG = PocketManager.class.getSimpleName(); + static final boolean DEBUG = false; + + /** + * Whether {@link IPocketCallback#onStateChanged(boolean, int)} + * was fired because of the sensor. + * @see PocketService#handleDispatchCallbacks() + */ + public static final int REASON_SENSOR = 0; + + /** + * Whether {@link IPocketCallback#onStateChanged(boolean, int)} + * was fired because of an error while accessing service. + * @see #addCallback(IPocketCallback) + * @see #removeCallback(IPocketCallback) + */ + public static final int REASON_ERROR = 1; + + /** + * Whether {@link IPocketCallback#onStateChanged(boolean, int)} + * was fired because of a needed reset. + * @see PocketService#binderDied() + */ + public static final int REASON_RESET = 2; + + private Context mContext; + private IPocketService mService; + private PowerManager mPowerManager; + private Handler mHandler; + private boolean mPocketViewTimerActive; + + public PocketManager(Context context, IPocketService service) { + mContext = context; + mService = service; + if (mService == null) { + Slog.v(TAG, "PocketService was null"); + } + mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); + mHandler = new Handler(); + } + + /** + * Add pocket state callback. + * @see PocketService#handleRemoveCallback(IPocketCallback) + */ + public void addCallback(final IPocketCallback callback) { + if (mService != null) try { + mService.addCallback(callback); + } catch (RemoteException e1) { + Log.w(TAG, "Remote exception in addCallback: ", e1); + if (callback != null){ + try { + callback.onStateChanged(false, REASON_ERROR); + } catch (RemoteException e2) { + Log.w(TAG, "Remote exception in callback.onPocketStateChanged: ", e2); + } + } + } + } + + /** + * Remove pocket state callback. + * @see PocketService#handleAddCallback(IPocketCallback) + */ + public void removeCallback(final IPocketCallback callback) { + if (mService != null) try { + mService.removeCallback(callback); + } catch (RemoteException e1) { + Log.w(TAG, "Remote exception in removeCallback: ", e1); + if (callback != null){ + try { + callback.onStateChanged(false, REASON_ERROR); + } catch (RemoteException e2) { + Log.w(TAG, "Remote exception in callback.onPocketStateChanged: ", e2); + } + } + } + } + + /** + * Notify service about device interactive state changed. + * {@link PhoneWindowManager#startedWakingUp()} + * {@link PhoneWindowManager#startedGoingToSleep(int)} + */ + public void onInteractiveChanged(boolean interactive) { + boolean isPocketViewShowing = (interactive && isDeviceInPocket()); + synchronized (mPocketLockTimeout) { + if (mPocketViewTimerActive != isPocketViewShowing) { + if (isPocketViewShowing) { + if (DEBUG) Log.v(TAG, "Setting pocket timer"); + mHandler.removeCallbacks(mPocketLockTimeout); // remove any pending requests + mHandler.postDelayed(mPocketLockTimeout, 3 * DateUtils.SECOND_IN_MILLIS); + mPocketViewTimerActive = true; + } else { + if (DEBUG) Log.v(TAG, "Clearing pocket timer"); + mHandler.removeCallbacks(mPocketLockTimeout); + mPocketViewTimerActive = false; + } + } + } + if (mService != null) try { + mService.onInteractiveChanged(interactive); + } catch (RemoteException e) { + Log.w(TAG, "Remote exception in addCallback: ", e); + } + } + + /** + * Request listening state change by, but not limited to, external process. + * @see PocketService#handleSetListeningExternal(boolean) + */ + public void setListeningExternal(boolean listen) { + if (mService != null) try { + mService.setListeningExternal(listen); + } catch (RemoteException e) { + Log.w(TAG, "Remote exception in setListeningExternal: ", e); + } + // Clear timeout when user hides pocket lock with long press power. + if (mPocketViewTimerActive && !listen) { + if (DEBUG) Log.v(TAG, "Clearing pocket timer due to override"); + mHandler.removeCallbacks(mPocketLockTimeout); + mPocketViewTimerActive = false; + } + } + + /** + * Return whether device is in pocket. + * @see PocketService#isDeviceInPocket() + * @return + */ + public boolean isDeviceInPocket() { + if (mService != null) try { + return mService.isDeviceInPocket(); + } catch (RemoteException e) { + Log.w(TAG, "Remote exception in isDeviceInPocket: ", e); + } + return false; + } + + class PocketLockTimeout implements Runnable { + @Override + public void run() { + mPowerManager.goToSleep(SystemClock.uptimeMillis()); + mPocketViewTimerActive = false; + } + } + + /** Custom methods **/ + + public void setPocketLockVisible(boolean visible) { + if (!visible){ + if (DEBUG) Log.v(TAG, "Clearing pocket timer"); + mHandler.removeCallbacks(mPocketLockTimeout); + mPocketViewTimerActive = false; + } + if (mService != null) try { + mService.setPocketLockVisible(visible); + } catch (RemoteException e) { + Log.w(TAG, "Remote exception in setPocketLockVisible: ", e); + } + } + + public boolean isPocketLockVisible() { + if (mService != null) try { + return mService.isPocketLockVisible(); + } catch (RemoteException e) { + Log.w(TAG, "Remote exception in isPocketLockVisible: ", e); + } + return false; + } + + private PocketLockTimeout mPocketLockTimeout = new PocketLockTimeout(); + +} diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index cd8e5abaa680..f5b2d5dffb17 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1818,6 +1818,20 @@ public final class Settings { public static final String ACTION_ENABLE_MMS_DATA_REQUEST = "android.settings.ENABLE_MMS_DATA_REQUEST"; + /** + * Activity Action: Show first time device intro + *

+ * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

+ * Input: Nothing. + *

+ * Output: Nothing + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_DEVICE_INTRODUCTION = + "android.settings.DEVICE_INTRODUCTION"; + /** * Integer value that specifies the reason triggering enable MMS data notification. * This must be passed as an extra field to the {@link #ACTION_ENABLE_MMS_DATA_REQUEST}. @@ -3437,6 +3451,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. @@ -4267,6 +4302,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). @@ -4401,182 +4460,1051 @@ public boolean validate(@Nullable String value) { public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND; /** - * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND} - * instead + * @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 = "dummy_show_battery_percent"; + + /** + * 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"; + + /** + * Whether the user has already accepted MediaProjection permission for the built-in screenrecorder + * @hide + */ + public static final String MEDIAPROJECTION_SYSUI_OK = "mediaprojection_sysui_ok"; + + /** + * 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 to show VoLTE icon or not + * @hide + */ + public static final String SHOW_VOLTE_ICON = "volte_icon"; + + /** + * 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"; + + /** + * 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 + */ + 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; + + /** + * @hide + */ + 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; + + /** + * @hide + */ + 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; + + /** + * @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 + */ + public static final String FOOTER_TEXT_SHOW = "footer_text_show"; + /** @hide */ + private static final Validator FOOTER_TEXT_SHOW_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * QS footer text + * @hide + */ + public static final String FOOTER_TEXT_STRING = "footer_text_string"; + /** @hide */ + private static final Validator FOOTER_TEXT_STRING_VALIDATOR = + ANY_STRING_VALIDATOR; + + /** + * QS Blur Radius + * @hide + */ + public static final String QS_BLUR_RADIUS = "qs_blur_radius"; + /** @hide */ + private static final Validator QS_BLUR_RADIUS_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 25); + + /** + * @hide + */ + public static final String LOCKSCREEN_WEATHER_SHOW_TEMP = "lockscreen_weather_show_temp"; + + /** @hide */ + private static final Validator LOCKSCREEN_WEATHER_SHOW_TEMP_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * @hide + */ + public static final String LOCKSCREEN_WEATHER_SHOW_CITY = "lockscreen_weather_show_city"; + + /** @hide */ + private static final Validator LOCKSCREEN_WEATHER_SHOW_CITY_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * Whether to display 4G icon instead LTE + * @hide + */ + public static final String SHOW_FOURG_ICON = "show_fourg_icon"; + + /** @hide */ + public static final String GESTURE_PILL_TOGGLE = "gesture_pill_toggle"; + + /** @hide */ + private static final Validator GESTURE_PILL_TOGGLE_VALIDATOR = BOOLEAN_VALIDATOR; + + /** + * Whether to show the battery info on the lockscreen while charging + * @hide + */ + public static final String LOCKSCREEN_BATTERY_INFO = "lockscreen_battery_info"; + + /** + * Enable/Disable screenshot sound + * @hide + */ + public static final String SCREENSHOT_SOUND = "screenshot_sound"; + + /** + * 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"; + + /** + * Preferred silent mode for Alert Slider.. + * 0: Alarms only. + * 1: Total silence + * @hide + */ + public static final String ALERT_SLIDER_SILENT_MODE = "alert_slider_silent_mode"; + + + /** + * 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 CUSTOM_BUTTON_EXTRA_KEY_MAPPING = "button_extra_mapping"; + + /** @hide */ + private static final Validator CUSTOM_BUTTON_EXTRA_KEY_MAPPING_VALIDATOR = + ANY_STRING_VALIDATOR; + + /** + * Enable proxi check for wake keys - must be implemented in a device + * KeyHandler + * @hide + */ + public static final String CUSTOM_DEVICE_PROXI_CHECK_ENABLED = "device_proxi_check_enabled"; + + /** @hide */ + private static final Validator CUSTOM_DEVICE_PROXI_CHECK_ENABLED_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * Enable Gesture Haptic feedback + * KeyHandler + * @hide + */ + public static final String CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED = + "device_gesture_feedback_enabled"; + + /** @hide */ + private static final Validator CUSTOM_DEVICE_GESTURE_FEEDBACK_ENABLED_VALIDATOR = + BOOLEAN_VALIDATOR; + + /** + * @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; + + /** @hide */ + public static final String BACK_GESTURE_HAPTIC = "back_gesture_haptic"; + + /** + * @hide + */ + public static final String SMART_CHARGING = "smart_charging"; + + /** + * @hide + */ + public static final String SMART_CHARGING_LEVEL = "smart_charging_level"; + + /** + * @hide + */ + public static final String SMART_CHARGING_RESUME_LEVEL = "smart_charging_resume_level"; + + /** + * Battery style + * @hide + */ + public static final String STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style"; + + /** + * Statusbar Battery % + * 0: Hide the battery percentage + * 1: Display the battery percentage + * 2: Display the battery percentage only while charging + * @hide + */ + public static final String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent"; + + /** + * Whether to display cross sign for a data disabled connection + * @hide + */ + public static final String DATA_DISABLED_ICON = "data_disabled_icon"; + + /** + * @hide + */ + public static final String ROAMING_INDICATOR_ICON = "roaming_indicator_icon"; + + /** + * Whether to show Brightness Icon On Brightness Slider + * @hide + */ + public static final String QS_SHOW_BRIGHTNESS_ICON = "qs_show_brightness_icon"; + + /** + * Change font style for the system lockscreen clock widget * @hide */ - @Deprecated - @UnsupportedAppUsage - public static final String LOCK_SOUND = Global.LOCK_SOUND; + public static final String LOCK_CLOCK_FONT_STYLE = "lock_clock_font_style"; /** - * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND} - * instead + * Change fonts for the system lockscreen date + * * @hide */ - @Deprecated - @UnsupportedAppUsage - public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND; + public static final String LOCK_DATE_FONTS = "lock_date_fonts"; /** - * Receive incoming SIP calls? - * 0 = no - * 1 = yes + * Whether the device introduction is completed * @hide */ - public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; + public static final String DEVICE_INTRODUCTION_COMPLETED = "device_introduction_completed"; /** @hide */ - public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = BOOLEAN_VALIDATOR; + private static final Validator DEVICE_INTRODUCTION_COMPLETED_VALIDATOR = + BOOLEAN_VALIDATOR; /** - * Call Preference String. - * "SIP_ALWAYS" : Always use SIP with network access - * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address + * Screenrecord: audio source * @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"}); + public static final String SCREENRECORD_AUDIO_SOURCE = "screenrecord_audio_source"; /** - * One of the sip call options: Always use SIP with network access. + * Screenrecord: show taps * @hide */ - public static final String SIP_ALWAYS = "SIP_ALWAYS"; + public static final String SCREENRECORD_SHOW_TAPS = "screenrecord_show_taps"; - /** @hide */ - public static final Validator SIP_ALWAYS_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * Screenrecord: show stop dot + * @hide + */ + public static final String SCREENRECORD_STOP_DOT = "screenrecord_stop_dot"; /** - * One of the sip call options: Only if destination is a SIP address. + * Screenrecord: video bitrate * @hide */ - public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; + public static final String SCREENRECORD_VIDEO_BITRATE = "screenrecord_video_bitrate"; + /** + * QS blur + * @hide + */ + public static final String QS_BLUR = "qs_blur"; /** @hide */ - public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = BOOLEAN_VALIDATOR; + private static final Validator QS_BLUR_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. + * Whether to show the battery bar * @hide */ - @Deprecated - public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; + public static final String BATTERY_BAR_LOCATION = "battery_bar_location"; - /** @hide */ - public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * @hide + */ + public static final String BATTERY_BAR_COLOR = "battery_bar_color"; /** - * 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"; + public static final String BATTERY_BAR_THICKNESS = "battery_bar_thickness"; - /** @hide */ - public static final Validator POINTER_SPEED_VALIDATOR = - new SettingsValidators.InclusiveFloatRangeValidator(-7, 7); + /** + * @hide + */ + public static final String BATTERY_BAR_STYLE = "battery_bar_style"; /** - * 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"; + public static final String BATTERY_BAR_ANIMATE = "battery_bar_animate"; - /** @hide */ - public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * @hide + */ + public static final String BATTERY_BAR_CHARGING_COLOR = "battery_bar_charging_color"; /** - * 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"; + public static final String BATTERY_BAR_BATTERY_LOW_COLOR_WARNING = "battery_bar_battery_low_color_warning"; - /** @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; - } - } - }; + /** + * @hide + */ + public static final String BATTERY_BAR_HIGH_COLOR = "battery_bar_high_color"; /** - * 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"; + public static final String BATTERY_BAR_LOW_COLOR = "battery_bar_low_color"; - /** @hide */ - private static final Validator SHOW_BATTERY_PERCENT_VALIDATOR = BOOLEAN_VALIDATOR; + /** + * @hide + */ + public static final String BATTERY_BAR_USE_GRADIENT_COLOR = "battery_bar_use_gradient_color"; /** - * 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. + * Whether allowing pocket service to register sensors and dispatch informations. + * 0 = disabled + * 1 = enabled + * @author Carlo Savignano * @hide */ - public static final String BUTTON_BACKLIGHT_TIMEOUT = "button_backlight_timeout"; + public static final String POCKET_JUDGE = "pocket_judge"; /** @hide */ - public static final Validator BUTTON_BACKLIGHT_TIMEOUT_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR; + public static final Validator POCKET_JUDGE_VALIDATOR = BOOLEAN_VALIDATOR; /** - * Whether the button backlight is only lit when pressed (and not when screen is touched) - * The value is boolean (1 or 0). + * FOD icon picker + * @hide */ - public static final String BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED = - "button_backlight_only_when_pressed"; + public static final String FOD_ICON = "fod_icon"; /** @hide */ - public static final Validator BUTTON_BACKLIGHT_ONLY_WHEN_PRESSED_VALIDATOR = - BOOLEAN_VALIDATOR; + private static final Validator FOD_ICON_VALIDATOR = ANY_STRING_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()} + * FOD pressed state * @hide */ - public static final String BUTTON_BRIGHTNESS = "button_brightness"; + public static final String FOD_PRESSED_STATE = "fod_pressed_state"; /** @hide */ - public static final Validator BUTTON_BRIGHTNESS_VALIDATOR = NON_NEGATIVE_INTEGER_VALIDATOR; + private static final Validator FOD_PRESSED_STATE_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 6); /** - * Check the proximity sensor during wakeup + * FOD recognizing animation * @hide */ - public static final String PROXIMITY_ON_WAKE = "proximity_on_wake"; + public static final String FOD_RECOGNIZING_ANIMATION = "fod_recognizing_animation"; /** @hide */ - public static final Validator PROXIMITY_ON_WAKE_VALIDATOR = + private static final Validator FOD_RECOGNIZING_ANIMATION_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. + * FOD recognizing animation picker + * @hide */ + public static final String FOD_ANIM = "fod_anim"; + + /** @hide */ + private static final Validator FOD_ANIM_VALIDATOR = + new SettingsValidators.InclusiveIntegerRangeValidator(0, 5); /** * Settings to backup. This is here so that it's in the same place as the settings @@ -4636,13 +5564,55 @@ public boolean validate(@Nullable String value) { LOCK_TO_APP_ENABLED, NOTIFICATION_SOUND, ACCELEROMETER_ROTATION, - SHOW_BATTERY_PERCENT, NOTIFICATION_VIBRATION_INTENSITY, RING_VIBRATION_INTENSITY, 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, + QS_BLUR_RADIUS, + 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, + QS_BLUR, + FOD_ICON, + FOD_PRESSED_STATE, + FOD_RECOGNIZING_ANIMATION, + FOD_ANIM, }; /** @@ -4657,6 +5627,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 * @@ -4760,12 +5759,63 @@ public boolean validate(@Nullable String value) { PRIVATE_SETTINGS.add(POINTER_SPEED); PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED); 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(QS_BLUR_RADIUS); + 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); + PRIVATE_SETTINGS.add(DEVICE_INTRODUCTION_COMPLETED); + PRIVATE_SETTINGS.add(POCKET_JUDGE); } /** @@ -4857,12 +5907,67 @@ public boolean validate(@Nullable String value) { VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); 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(QS_BLUR_RADIUS, QS_BLUR_RADIUS_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); + VALIDATORS.put(DEVICE_INTRODUCTION_COMPLETED, DEVICE_INTRODUCTION_COMPLETED_VALIDATOR); + VALIDATORS.put(QS_BLUR, QS_BLUR_VALIDATOR); + VALIDATORS.put(POCKET_JUDGE, POCKET_JUDGE_VALIDATOR); + VALIDATORS.put(FOD_ICON, FOD_ICON_VALIDATOR); + VALIDATORS.put(FOD_PRESSED_STATE, FOD_PRESSED_STATE_VALIDATOR); + VALIDATORS.put(FOD_RECOGNIZING_ANIMATION, FOD_RECOGNIZING_ANIMATION_VALIDATOR); + VALIDATORS.put(FOD_ANIM, FOD_ANIM_VALIDATOR); } /** @@ -8374,6 +9479,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. @@ -8677,6 +9797,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. @@ -8769,6 +9895,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 @@ -9063,6 +10197,14 @@ public boolean validate(@Nullable String value) { */ public static final String NEARBY_SHARING_COMPONENT = "nearby_sharing_component"; + /** + * Whether to show or hide the arrow for back gesture + * @hide + */ + public static final String SHOW_BACK_ARROW_GESTURE = "show_back_arrow_gesture"; + + private static final Validator SHOW_BACK_ARROW_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR; + /** * Controls whether aware is enabled. * @hide @@ -9079,6 +10221,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 @@ -9087,6 +10311,26 @@ 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; + /** * This are the settings to be backed up. * @@ -9162,6 +10406,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, @@ -9223,7 +10468,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 }; /** @@ -9331,8 +10577,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); @@ -9354,6 +10604,7 @@ public boolean validate(@Nullable String value) { VALIDATORS.put(ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_ENABLED_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR); + VALIDATORS.put(SHOW_BACK_ARROW_GESTURE, SHOW_BACK_ARROW_GESTURE_VALIDATOR); VALIDATORS.put(ASSIST_GESTURE_WAKE_ENABLED, ASSIST_GESTURE_WAKE_ENABLED_VALIDATOR); VALIDATORS.put(VR_DISPLAY_MODE, VR_DISPLAY_MODE_VALIDATOR); VALIDATORS.put(NOTIFICATION_BADGING, NOTIFICATION_BADGING_VALIDATOR); @@ -9421,6 +10672,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); } /** @@ -12653,6 +13905,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 @@ -13988,6 +15264,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/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/FeatureFlagUtils.java b/core/java/android/util/FeatureFlagUtils.java index 0e0c676c2782..49d460f5c776 100644 --- a/core/java/android/util/FeatureFlagUtils.java +++ b/core/java/android/util/FeatureFlagUtils.java @@ -38,7 +38,7 @@ public class FeatureFlagUtils { public static final String PERSIST_PREFIX = "persist." + FFLAG_OVERRIDE_PREFIX; public static final String SEAMLESS_TRANSFER = "settings_seamless_transfer"; public static final String HEARING_AID_SETTINGS = "settings_bluetooth_hearing_aid"; - public static final String SCREENRECORD_LONG_PRESS = "settings_screenrecord_long_press"; + //public static final String SCREENRECORD_LONG_PRESS = "settings_screenrecord_long_press"; public static final String PIXEL_WALLPAPER_CATEGORY_SWITCH = "settings_pixel_wallpaper_category_switch"; public static final String DYNAMIC_SYSTEM = "settings_dynamic_system"; @@ -54,7 +54,7 @@ public class FeatureFlagUtils { DEFAULT_FLAGS.put(DYNAMIC_SYSTEM, "false"); DEFAULT_FLAGS.put(SEAMLESS_TRANSFER, "false"); DEFAULT_FLAGS.put(HEARING_AID_SETTINGS, "false"); - DEFAULT_FLAGS.put(SCREENRECORD_LONG_PRESS, "false"); + //DEFAULT_FLAGS.put(SCREENRECORD_LONG_PRESS, "false"); DEFAULT_FLAGS.put(PIXEL_WALLPAPER_CATEGORY_SWITCH, "false"); DEFAULT_FLAGS.put("settings_wifi_details_datausage_header", "false"); DEFAULT_FLAGS.put("settings_skip_direction_mutable", "true"); 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..6628a22c66b2 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. */ @@ -638,4 +644,10 @@ interface IWindowManager * native InputManager before proceeding with tests. */ void syncInputTransactions(); + + /** + * Long screenshot + * @hide + */ + void takeAlternativeScreenshot(); } 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/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index d3618adca6c4..032af1c5c7b5 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -92,10 +92,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.concurrent.CancellationException; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; /** @@ -424,13 +421,6 @@ public static void ensureDefaultInstanceForDefaultDisplayIfNecessary() { int mCursorCandStart; int mCursorCandEnd; - /** - * Initial startInput with {@link StartInputReason.WINDOW_FOCUS_GAIN} is executed - * in a background thread. Later, if there is an actual startInput it will wait on - * main thread till the background thread completes. - */ - private CompletableFuture mWindowFocusGainFuture; - /** * The instance that has previously been sent to the input method. */ @@ -655,14 +645,14 @@ public void handleMessage(Message msg) { } catch (RemoteException e) { } } - } - // Check focus again in case that "onWindowFocus" is called before - // handling this message. - if (mServedView != null && canStartInput(mServedView)) { - if (checkFocusNoStartInput(mRestartOnNextWindowFocus)) { - final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS - : StartInputReason.DEACTIVATED_BY_IMMS; - startInputInner(reason, null, 0, 0, 0); + // Check focus again in case that "onWindowFocus" is called before + // handling this message. + if (mServedView != null && canStartInput(mServedView)) { + if (checkFocusNoStartInput(mRestartOnNextWindowFocus)) { + final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS + : StartInputReason.DEACTIVATED_BY_IMMS; + startInputInner(reason, null, 0, 0, 0); + } } } return; @@ -1225,10 +1215,6 @@ public boolean isAcceptingText() { */ void clearBindingLocked() { if (DEBUG) Log.v(TAG, "Clearing binding!"); - if (mWindowFocusGainFuture != null) { - mWindowFocusGainFuture.cancel(false /* mayInterruptIfRunning */); - mWindowFocusGainFuture = null; - } clearConnectionLocked(); setInputChannelLocked(null); mBindSequence = -1; @@ -1612,18 +1598,6 @@ public void restartInput(View view) { boolean startInputInner(@StartInputReason int startInputReason, @Nullable IBinder windowGainingFocus, @StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode, int windowFlags) { - if (startInputReason != StartInputReason.WINDOW_FOCUS_GAIN - && mWindowFocusGainFuture != null) { - try { - mWindowFocusGainFuture.get(); - } catch (ExecutionException | InterruptedException e) { - // do nothing - } catch (CancellationException e) { - // window no longer has focus. - return true; - } - } - final View view; synchronized (mH) { view = mServedView; @@ -1977,38 +1951,31 @@ public void onPostWindowFocus(View rootView, View focusedView, startInputFlags |= StartInputFlags.FIRST_WINDOW_FOCUS_GAIN; } - final boolean forceNewFocus1 = forceNewFocus; - final int startInputFlags1 = startInputFlags; - if (mWindowFocusGainFuture != null) { - mWindowFocusGainFuture.cancel(false/* mayInterruptIfRunning */); - } - mWindowFocusGainFuture = CompletableFuture.runAsync(() -> { - if (checkFocusNoStartInput(forceNewFocus1)) { - // We need to restart input on the current focus view. This - // should be done in conjunction with telling the system service - // about the window gaining focus, to help make the transition - // smooth. - if (startInputInner(StartInputReason.WINDOW_FOCUS_GAIN, rootView.getWindowToken(), - startInputFlags1, softInputMode, windowFlags)) { - return; - } + if (checkFocusNoStartInput(forceNewFocus)) { + // We need to restart input on the current focus view. This + // should be done in conjunction with telling the system service + // about the window gaining focus, to help make the transition + // smooth. + if (startInputInner(StartInputReason.WINDOW_FOCUS_GAIN, rootView.getWindowToken(), + startInputFlags, softInputMode, windowFlags)) { + return; } + } - // For some reason we didn't do a startInput + windowFocusGain, so - // we'll just do a window focus gain and call it a day. - synchronized (mH) { - try { - if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput"); - mService.startInputOrWindowGainedFocus( - StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, mClient, - rootView.getWindowToken(), startInputFlags1, softInputMode, windowFlags, - null, null, 0 /* missingMethodFlags */, - rootView.getContext().getApplicationInfo().targetSdkVersion); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } + // For some reason we didn't do a startInput + windowFocusGain, so + // we'll just do a window focus gain and call it a day. + synchronized (mH) { + try { + if (DEBUG) Log.v(TAG, "Reporting focus gain, without startInput"); + mService.startInputOrWindowGainedFocus( + StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, mClient, + rootView.getWindowToken(), startInputFlags, softInputMode, windowFlags, + null, null, 0 /* missingMethodFlags */, + rootView.getContext().getApplicationInfo().targetSdkVersion); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); } - }); + } } /** @hide */ @@ -2023,10 +1990,6 @@ public void onPreWindowFocus(View rootView, boolean hasWindowFocus) { // If the mCurRootView is losing window focus, release the strong reference to it // so as not to prevent it from being garbage-collected. mCurRootView = null; - if (mWindowFocusGainFuture != null) { - mWindowFocusGainFuture.cancel(false /* mayInterruptIfRunning */); - mWindowFocusGainFuture = null; - } } else { if (DEBUG) { Log.v(TAG, "Ignoring onPreWindowFocus()." 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/custom/screenshot/StitchImageUtility.java b/core/java/com/android/internal/custom/screenshot/StitchImageUtility.java new file mode 100644 index 000000000000..ad181d4c9b49 --- /dev/null +++ b/core/java/com/android/internal/custom/screenshot/StitchImageUtility.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2019 PixelExperience + * + * 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 3 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.custom.screenshot; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.media.MediaActionSound; +import android.net.Uri; +import android.os.UserHandle; +import android.provider.Settings; +import android.util.Log; + +import java.util.List; + +public class StitchImageUtility { + public static final String STITCHIMAGE_APP_PACKAGE_NAME = "com.asus.stitchimage"; + public static final String STITCHIMAGE_FILEPROVIDER_CLASS = "com.asus.stitchimage.fileprovider"; + private static final String STITCHIMAGE_OVERLAY_SERVICE_CLASS = "com.asus.stitchimage.OverlayService"; + private static final String STITCHIMAGE_SERVICE_PACKAGE_NAME = "com.asus.stitchimage.service"; + private static final String EXTRA_KEY_STITCHIMAGE_SETTINGS_CALLFROM = "callfrom"; + private static final String EXTRA_VALUE_STITCHIMAGE_SETTINGS_CALLFROM_ASUSSETTINGS = "AsusSettings"; + private static String TAG = "StitchImageUtility"; + private final Context mContext; + private MediaActionSound mCameraSound; + private PackageManager mPackageManager; + + public StitchImageUtility(Context context) { + mContext = context; + mPackageManager = mContext.getPackageManager(); + } + + public boolean takeScreenShot(String focusedPackageName) { + if (isPackageAllowed(focusedPackageName)) { + try { + Log.i(TAG, "Take long screenshot."); + Intent intent = new Intent(); + intent.setComponent(new ComponentName(STITCHIMAGE_APP_PACKAGE_NAME, STITCHIMAGE_OVERLAY_SERVICE_CLASS)); + intent.putExtra(EXTRA_KEY_STITCHIMAGE_SETTINGS_CALLFROM, EXTRA_VALUE_STITCHIMAGE_SETTINGS_CALLFROM_ASUSSETTINGS); + mContext.startService(intent); + playScreenshotSound(); + return true; + } catch (Exception e) { + Log.e(TAG, "trigger stitchimage failed, Exception :" + e); + } + } + return false; + } + + private void playScreenshotSound(){ + if (mCameraSound == null){ + mCameraSound = new MediaActionSound(); + mCameraSound.load(MediaActionSound.SHUTTER_CLICK); + } + if (Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.SCREENSHOT_SOUND, 1, UserHandle.USER_CURRENT) == 1) { + mCameraSound.play(MediaActionSound.SHUTTER_CLICK); + } + } + + private boolean isPackageAllowed(String focusedPackageName){ + if (focusedPackageName == null || focusedPackageName.equals("") + || focusedPackageName.equals("com.android.settings")){ + return true; + } + if (focusedPackageName.equals("com.android.systemui")){ + return false; + } + Intent i = new Intent(Intent.ACTION_MAIN); + i.addCategory(Intent.CATEGORY_HOME); + List homePackages = mPackageManager.queryIntentActivities(i, 0); + for (ResolveInfo resolveInfo : homePackages) { + if (focusedPackageName.equals(resolveInfo.activityInfo.packageName)){ + return false; + } + } + return true; + } +} 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/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 3113004a406d..bac622fe83c0 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -5417,7 +5417,7 @@ public void noteResetVideoLocked() { if (mVideoOnNesting > 0) { final long elapsedRealtime = mClocks.elapsedRealtime(); final long uptime = mClocks.uptimeMillis(); - mAudioOnNesting = 0; + mVideoOnNesting = 0; mHistoryCur.states2 &= ~HistoryItem.STATE2_VIDEO_ON_FLAG; if (DEBUG_HISTORY) Slog.v(TAG, "Video off to: " + Integer.toHexString(mHistoryCur.states)); 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 bde5314ff529..7e6d81fc85de 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, @@ -175,4 +175,10 @@ 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); + + void setPartialScreenshot(boolean active); } diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index fd2acb2c9777..4f2f4338009e 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); @@ -113,4 +113,12 @@ interface IStatusBarService // Used to show or hide in display fingerprint view void showInDisplayFingerprintView(); void hideInDisplayFingerprintView(); + + /** + * Extra features functions + */ + void toggleCameraFlash(); + void toggleCameraFlashState(boolean enable); + + void setPartialScreenshot(boolean active); } diff --git a/core/java/com/android/internal/util/ScreenshotHelper.java b/core/java/com/android/internal/util/ScreenshotHelper.java index d24d78c6f3da..877fc6c7427e 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; @@ -14,6 +16,9 @@ import android.os.RemoteException; import android.os.UserHandle; import android.util.Log; +import android.view.WindowManager; + +import com.android.internal.custom.screenshot.StitchImageUtility; import java.util.function.Consumer; @@ -32,9 +37,11 @@ public class ScreenshotHelper { private final Object mScreenshotLock = new Object(); private ServiceConnection mScreenshotConnection = null; private final Context mContext; + private final StitchImageUtility mStitchImageUtility; public ScreenshotHelper(Context context) { mContext = context; + mStitchImageUtility = new StitchImageUtility(mContext); } /** @@ -61,7 +68,36 @@ public void takeScreenshot(final int screenshotType, final boolean hasStatus, final boolean hasNav, @NonNull Handler handler, @Nullable Consumer completionConsumer) { takeScreenshot(screenshotType, hasStatus, hasNav, SCREENSHOT_TIMEOUT_MS, handler, - completionConsumer); + completionConsumer, null); + } + + /** + * Request a screenshot be taken. + * + * Added to support reducing unit test duration; the method variant without a timeout argument + * is recommended for general use. + * + * @param screenshotType The type of screenshot, for example either + * {@link android.view.WindowManager.TAKE_SCREENSHOT_FULLSCREEN} + * or + * {@link android.view.WindowManager.TAKE_SCREENSHOT_SELECTED_REGION} + * @param hasStatus {@code true} if the status bar is currently showing. {@code false} + * if + * not. + * @param hasNav {@code true} if the navigation bar is currently showing. {@code + * false} + * if not. + * @param handler A handler used in case the screenshot times out + * @param completionConsumer Consumes `null` if a screenshot was not taken, and the URI of the + * screenshot if the screenshot was taken. + * @param focusedPackageName The focused package name + */ + public void takeScreenshot(final int screenshotType, final boolean hasStatus, + final boolean hasNav, @NonNull Handler handler, + @Nullable Consumer completionConsumer, + final String focusedPackageName) { + takeScreenshot(screenshotType, hasStatus, hasNav, SCREENSHOT_TIMEOUT_MS, handler, + completionConsumer, focusedPackageName); } /** @@ -86,11 +122,17 @@ public void takeScreenshot(final int screenshotType, final boolean hasStatus, * @param handler A handler used in case the screenshot times out * @param completionConsumer Consumes `null` if a screenshot was not taken, and the URI of the * screenshot if the screenshot was taken. + * @param focusedPackageName The focused package name */ public void takeScreenshot(final int screenshotType, final boolean hasStatus, final boolean hasNav, long timeoutMs, @NonNull Handler handler, - @Nullable Consumer completionConsumer) { + @Nullable Consumer completionConsumer, + final String focusedPackageName) { synchronized (mScreenshotLock) { + if (screenshotType == WindowManager.TAKE_SCREENSHOT_FULLSCREEN && + mStitchImageUtility.takeScreenShot(focusedPackageName)){ + return; + } if (mScreenshotConnection != null) { return; } @@ -172,7 +214,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/BootlegUtils.java b/core/java/com/android/internal/util/bootleggers/BootlegUtils.java index a3844203dd8d..ba68b20fcf22 100644 --- a/core/java/com/android/internal/util/bootleggers/BootlegUtils.java +++ b/core/java/com/android/internal/util/bootleggers/BootlegUtils.java @@ -27,9 +27,18 @@ 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; @@ -39,6 +48,9 @@ public class BootlegUtils { 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"; + private static IStatusBarService mStatusBarService = null; public static boolean isChineseLanguage() { return Resources.getSystem().getConfiguration().locale.getLanguage().startsWith( @@ -67,6 +79,35 @@ public static boolean deviceSupportsFlashLight(Context context) { 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 void setPartialScreenshot(boolean active) { + IStatusBarService service = getStatusBarService(); + if (service != null) { + try { + service.setPartialScreenshot(active); + } catch (RemoteException e) {} + } + } + public static boolean isWifiOnly(Context context) { ConnectivityManager cm = (ConnectivityManager)context.getSystemService( Context.CONNECTIVITY_SERVICE); @@ -88,10 +129,52 @@ public static boolean isPackageInstalled(Context context, String pkg, boolean ig 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); @@ -126,6 +209,16 @@ public static boolean isTablet(Context context) { return getScreenType(context) == DEVICE_TABLET; } + private static IStatusBarService getStatusBarService() { + synchronized (BootlegUtils.class) { + if (mStatusBarService == null) { + mStatusBarService = IStatusBarService.Stub.asInterface( + ServiceManager.getService("statusbar")); + } + return mStatusBarService; + } + } + // Omni Switch Constants /** 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/ImageHelper.java b/core/java/com/android/internal/util/bootleggers/ImageHelper.java index 0f7bf4863c7b..56166b4a7984 100644 --- a/core/java/com/android/internal/util/bootleggers/ImageHelper.java +++ b/core/java/com/android/internal/util/bootleggers/ImageHelper.java @@ -34,7 +34,13 @@ 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 { @@ -55,10 +61,15 @@ public static Bitmap getColoredBitmap(Drawable d, int color) { return grayscaleBitmap; } - private static Bitmap toGrayscale(Bitmap bmpOriginal) { + 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); @@ -74,6 +85,18 @@ private static Bitmap toGrayscale(Bitmap bmpOriginal) { 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; @@ -101,6 +124,42 @@ public static Drawable resize(Context context, Drawable image, int size) { 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; @@ -144,4 +203,48 @@ public static Bitmap getCircleBitmap(Bitmap bitmap) { 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/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/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 3d2b0dfdd247..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); } @@ -1682,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 9f58bf26e71f..26ebbcbe04e5 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -1094,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", diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 0848ffafd01d..0bc5e7aad767 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2635,6 +2635,13 @@ android:description="@string/permdesc_getPackageSize" android:protectionLevel="normal" /> + + + @@ -5017,6 +5024,9 @@ android:resource="@xml/autofill_compat_accessibility_service" /> + + 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/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/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/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/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_pocket_lock.xml b/core/res/res/drawable/ic_pocket_lock.xml new file mode 100644 index 000000000000..3494a8f38b84 --- /dev/null +++ b/core/res/res/drawable/ic_pocket_lock.xml @@ -0,0 +1,10 @@ + + + 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/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_permission_item.xml b/core/res/res/layout/app_permission_item.xml index 383d771074e0..a80d40efd2be 100644 --- a/core/res/res/layout/app_permission_item.xml +++ b/core/res/res/layout/app_permission_item.xml @@ -32,7 +32,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:scaleType="fitCenter" - android:tint="@android:color/black"/> + android:tint="@color/app_permission_icon_tint"/> - - + + - + + - - - - \ No newline at end of file + android:layout_gravity="top|center_horizontal" + android:gravity="center" + android:textColor="?android:attr/textColorTertiary" + android:textAppearance="?android:attr/textAppearanceSmall" + /> + diff --git a/core/res/res/layout/global_actions_silent_mode.xml b/core/res/res/layout/global_actions_silent_mode.xml index a3586232a152..dbdb638a37df 100644 --- a/core/res/res/layout/global_actions_silent_mode.xml +++ b/core/res/res/layout/global_actions_silent_mode.xml @@ -17,26 +17,26 @@ - \ No newline at end of file + diff --git a/core/res/res/layout/immersive_mode_cling.xml b/core/res/res/layout/immersive_mode_cling.xml index 9fd615dc96b7..6dbde20d4811 100644 --- a/core/res/res/layout/immersive_mode_cling.xml +++ b/core/res/res/layout/immersive_mode_cling.xml @@ -16,7 +16,7 @@ @@ -47,7 +47,7 @@ android:paddingTop="8dp" android:scaleType="center" android:src="@drawable/ic_expand_more_48dp" - android:tint="?android:attr/colorAccent"/> + android:tint="@color/immersive_cling_bg_color"/>