Merge "Avoid copying NoCopySpans."
diff --git a/api/current.txt b/api/current.txt
index 67cdc9c..475aa54 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -34264,7 +34264,7 @@
method public static final deprecated void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean);
field public static final java.lang.String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled";
field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled";
- field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
+ field public static final deprecated java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled";
field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins";
field public static final deprecated java.lang.String ALLOW_MOCK_LOCATION = "mock_location";
diff --git a/api/system-current.txt b/api/system-current.txt
index dcd2103..c80beff 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -37369,7 +37369,7 @@
method public static final deprecated void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean);
field public static final java.lang.String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled";
field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled";
- field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
+ field public static final deprecated java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled";
field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins";
field public static final deprecated java.lang.String ALLOW_MOCK_LOCATION = "mock_location";
diff --git a/api/test-current.txt b/api/test-current.txt
index 319d9f3..fec5edc 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -34387,7 +34387,7 @@
method public static final deprecated void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean);
field public static final java.lang.String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled";
field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled";
- field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
+ field public static final deprecated java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled";
field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins";
field public static final deprecated java.lang.String ALLOW_MOCK_LOCATION = "mock_location";
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java
index d1000ad..13b9206 100644
--- a/core/java/android/inputmethodservice/KeyboardView.java
+++ b/core/java/android/inputmethodservice/KeyboardView.java
@@ -988,49 +988,31 @@
if (mAccessibilityManager.isEnabled()) {
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
onInitializeAccessibilityEvent(event);
- String text = null;
- // This is very efficient since the properties are cached.
- final boolean speakPassword = Settings.Secure.getIntForUser(
- mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0,
- UserHandle.USER_CURRENT_OR_SELF) != 0;
- // Add text only if password announcement is enabled or if headset is
- // used to avoid leaking passwords.
- if (speakPassword || mAudioManager.isBluetoothA2dpOn()
- || mAudioManager.isWiredHeadsetOn()) {
- switch (code) {
- case Keyboard.KEYCODE_ALT:
- text = mContext.getString(R.string.keyboardview_keycode_alt);
- break;
- case Keyboard.KEYCODE_CANCEL:
- text = mContext.getString(R.string.keyboardview_keycode_cancel);
- break;
- case Keyboard.KEYCODE_DELETE:
- text = mContext.getString(R.string.keyboardview_keycode_delete);
- break;
- case Keyboard.KEYCODE_DONE:
- text = mContext.getString(R.string.keyboardview_keycode_done);
- break;
- case Keyboard.KEYCODE_MODE_CHANGE:
- text = mContext.getString(R.string.keyboardview_keycode_mode_change);
- break;
- case Keyboard.KEYCODE_SHIFT:
- text = mContext.getString(R.string.keyboardview_keycode_shift);
- break;
- case '\n':
- text = mContext.getString(R.string.keyboardview_keycode_enter);
- break;
- default:
- text = String.valueOf((char) code);
- }
- } else if (!mHeadsetRequiredToHearPasswordsAnnounced) {
- // We want the waring for required head set to be send with both the
- // hover enter and hover exit event, so set the flag after the exit.
- if (eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) {
- mHeadsetRequiredToHearPasswordsAnnounced = true;
- }
- text = mContext.getString(R.string.keyboard_headset_required_to_hear_password);
- } else {
- text = mContext.getString(R.string.keyboard_password_character_no_headset);
+ final String text;
+ switch (code) {
+ case Keyboard.KEYCODE_ALT:
+ text = mContext.getString(R.string.keyboardview_keycode_alt);
+ break;
+ case Keyboard.KEYCODE_CANCEL:
+ text = mContext.getString(R.string.keyboardview_keycode_cancel);
+ break;
+ case Keyboard.KEYCODE_DELETE:
+ text = mContext.getString(R.string.keyboardview_keycode_delete);
+ break;
+ case Keyboard.KEYCODE_DONE:
+ text = mContext.getString(R.string.keyboardview_keycode_done);
+ break;
+ case Keyboard.KEYCODE_MODE_CHANGE:
+ text = mContext.getString(R.string.keyboardview_keycode_mode_change);
+ break;
+ case Keyboard.KEYCODE_SHIFT:
+ text = mContext.getString(R.string.keyboardview_keycode_shift);
+ break;
+ case '\n':
+ text = mContext.getString(R.string.keyboardview_keycode_enter);
+ break;
+ default:
+ text = String.valueOf((char) code);
}
event.getText().add(text);
mAccessibilityManager.sendAccessibilityEvent(event);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index ebc5b88..3ece9b3 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -5492,7 +5492,12 @@
/**
* Whether to speak passwords while in accessibility mode.
+ *
+ * @deprecated The speaking of passwords is controlled by individual accessibility services.
+ * Apps should ignore this setting and provide complete information to accessibility
+ * at all times, which was the behavior when this value was {@code true}.
*/
+ @Deprecated
public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
/**
diff --git a/core/java/android/service/autofill/FillResponse.java b/core/java/android/service/autofill/FillResponse.java
index bac4391..86688d3 100644
--- a/core/java/android/service/autofill/FillResponse.java
+++ b/core/java/android/service/autofill/FillResponse.java
@@ -28,6 +28,8 @@
import android.view.autofill.AutoFillManager;
import android.widget.RemoteViews;
+import java.util.ArrayList;
+
/**
* Response for a {@link
* AutoFillService#onFillRequest(android.app.assist.AssistStructure,
@@ -163,7 +165,7 @@
*/
public final class FillResponse implements Parcelable {
- private final ArraySet<Dataset> mDatasets;
+ private final ArrayList<Dataset> mDatasets;
private final ArraySet<AutoFillId> mSavableIds;
private final Bundle mExtras;
private final RemoteViews mPresentation;
@@ -183,7 +185,7 @@
}
/** @hide */
- public @Nullable ArraySet<Dataset> getDatasets() {
+ public @Nullable ArrayList<Dataset> getDatasets() {
return mDatasets;
}
@@ -207,7 +209,7 @@
* one dataset or set an authentication intent with a presentation view.
*/
public static final class Builder {
- private ArraySet<Dataset> mDatasets;
+ private ArrayList<Dataset> mDatasets;
private ArraySet<AutoFillId> mSavableIds;
private Bundle mExtras;
private RemoteViews mPresentation;
@@ -284,7 +286,7 @@
return this;
}
if (mDatasets == null) {
- mDatasets = new ArraySet<>();
+ mDatasets = new ArrayList<>();
}
if (!mDatasets.add(dataset)) {
return this;
@@ -398,7 +400,7 @@
@Override
public void writeToParcel(Parcel parcel, int flags) {
- parcel.writeTypedArraySet(mDatasets, flags);
+ parcel.writeTypedArrayList(mDatasets, flags);
parcel.writeTypedArraySet(mSavableIds, flags);
parcel.writeParcelable(mExtras, flags);
parcel.writeParcelable(mPresentation, flags);
@@ -413,10 +415,10 @@
// the system obeys the contract of the builder to avoid attacks
// using specially crafted parcels.
final Builder builder = new Builder();
- final ArraySet<Dataset> datasets = parcel.readTypedArraySet(null);
+ final ArrayList<Dataset> datasets = parcel.readTypedArrayList(null);
final int datasetCount = (datasets != null) ? datasets.size() : 0;
for (int i = 0; i < datasetCount; i++) {
- builder.addDataset(datasets.valueAt(i));
+ builder.addDataset(datasets.get(i));
}
final ArraySet<AutoFillId> fillIds = parcel.readTypedArraySet(null);
final int fillIdCount = (fillIds != null) ? fillIds.size() : 0;
diff --git a/core/java/android/view/autofill/AutoFillManager.java b/core/java/android/view/autofill/AutoFillManager.java
index d9003a6..2168444 100644
--- a/core/java/android/view/autofill/AutoFillManager.java
+++ b/core/java/android/view/autofill/AutoFillManager.java
@@ -179,8 +179,6 @@
* @param view view whose focus changed.
*/
public void valueChanged(View view) {
- ensureServiceClientAddedIfNeeded();
-
if (!mEnabled || !mHasSession) {
return;
}
@@ -199,8 +197,6 @@
* @param value new value of the child.
*/
public void virtualValueChanged(View parent, int childId, AutoFillValue value) {
- ensureServiceClientAddedIfNeeded();
-
if (!mEnabled || !mHasSession) {
return;
}
@@ -216,8 +212,6 @@
* call this method after the form is submitted and another page is rendered.
*/
public void reset() {
- ensureServiceClientAddedIfNeeded();
-
if (!mEnabled && !mHasSession) {
return;
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index bfaddaf..ab29257 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -63,7 +63,6 @@
import android.os.Parcelable;
import android.os.ParcelableParcel;
import android.os.SystemClock;
-import android.os.UserHandle;
import android.provider.Settings;
import android.text.BoringLayout;
import android.text.DynamicLayout;
@@ -9854,16 +9853,6 @@
}
}
- /**
- * @return true if the user has explicitly allowed accessibility services
- * to speak passwords.
- */
- private boolean shouldSpeakPasswordsForAccessibility() {
- return (Settings.Secure.getIntForUser(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0,
- UserHandle.USER_CURRENT_OR_SELF) == 1);
- }
-
@Override
public CharSequence getAccessibilityClassName() {
return TextView.class.getName();
@@ -10436,13 +10425,7 @@
return mHint;
}
- // Check whether we need to bypass the transformation
- // method and expose unobscured text.
- if (hasPasswordTransformationMethod() && shouldSpeakPasswordsForAccessibility()) {
- return mText;
- }
-
- // Otherwise, speak whatever text is being displayed.
+ // Otherwise, return whatever text is being displayed.
return mTransformed;
}
@@ -11559,9 +11542,7 @@
+ " before=" + before + " after=" + after + ": " + buffer);
}
- if (AccessibilityManager.getInstance(mContext).isEnabled()
- && ((!isPasswordInputType(getInputType()) && !hasPasswordTransformationMethod())
- || shouldSpeakPasswordsForAccessibility())) {
+ if (AccessibilityManager.getInstance(mContext).isEnabled()) {
mBeforeText = buffer.toString();
}
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java
index 4ba19f4..ae2e0ac 100644
--- a/core/java/com/android/internal/widget/LockPatternView.java
+++ b/core/java/com/android/internal/widget/LockPatternView.java
@@ -1489,21 +1489,10 @@
return bounds;
}
- private boolean shouldSpeakPassword() {
- final boolean speakPassword = Settings.Secure.getIntForUser(
- mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0,
- UserHandle.USER_CURRENT_OR_SELF) != 0;
- final boolean hasHeadphones = mAudioManager != null ?
- (mAudioManager.isWiredHeadsetOn() || mAudioManager.isBluetoothA2dpOn())
- : false;
- return speakPassword || hasHeadphones;
- }
-
private CharSequence getTextForVirtualView(int virtualViewId) {
final Resources res = getResources();
- return shouldSpeakPassword() ? res.getString(
- R.string.lockscreen_access_pattern_cell_added_verbose, virtualViewId)
- : res.getString(R.string.lockscreen_access_pattern_cell_added);
+ return res.getString(R.string.lockscreen_access_pattern_cell_added_verbose,
+ virtualViewId);
}
/**
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 2aa16b2..30d6337 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -455,10 +455,17 @@
const SkImageInfo decodeInfo = SkImageInfo::Make(size.width(), size.height(),
decodeColorType, decodeAlphaType, codec->computeOutputColorSpace(decodeColorType));
- // When supported by the colorType, we will decode to sRGB (or linear sRGB). However,
- // we only want to mark the bitmap as sRGB when linear blending is enabled.
- SkImageInfo bitmapInfo = decodeInfo.makeAlphaType(alphaType)
- .makeColorSpace(GraphicsJNI::colorSpaceForType(decodeColorType));
+ SkImageInfo bitmapInfo = decodeInfo.makeAlphaType(alphaType);
+
+ // For wide gamut images, we will leave the color space on the SkBitmap. Otherwise,
+ // use the default.
+ sk_sp<SkColorSpace> srgb =
+ SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma,
+ SkColorSpace::kSRGB_Gamut,
+ SkColorSpace::kNonLinearBlending_ColorSpaceFlag);
+ if (decodeInfo.colorSpace() == srgb.get()) {
+ bitmapInfo = bitmapInfo.makeColorSpace(GraphicsJNI::colorSpaceForType(decodeColorType));
+ }
if (decodeColorType == kGray_8_SkColorType) {
// The legacy implementation of BitmapFactory used kAlpha8 for
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp
index 0099673..2b1da25 100644
--- a/core/jni/android/graphics/SurfaceTexture.cpp
+++ b/core/jni/android/graphics/SurfaceTexture.cpp
@@ -34,6 +34,7 @@
#include "jni.h"
#include "JNIHelp.h"
+#include "ScopedLocalRef.h"
// ----------------------------------------------------------------------------
@@ -385,7 +386,6 @@
// ----------------------------------------------------------------------------
static const JNINativeMethod gSurfaceTextureMethods[] = {
- {"nativeClassInit", "()V", (void*)SurfaceTexture_classInit },
{"nativeInit", "(ZIZLjava/lang/ref/WeakReference;)V", (void*)SurfaceTexture_init },
{"nativeFinalize", "()V", (void*)SurfaceTexture_finalize },
{"nativeSetDefaultBufferSize", "(II)V", (void*)SurfaceTexture_setDefaultBufferSize },
@@ -401,6 +401,10 @@
int register_android_graphics_SurfaceTexture(JNIEnv* env)
{
+ // Cache some fields.
+ ScopedLocalRef<jclass> klass(env, FindClassOrDie(env, kSurfaceTextureClassPathName));
+ SurfaceTexture_classInit(env, klass.get());
+
return RegisterMethodsOrDie(env, kSurfaceTextureClassPathName, gSurfaceTextureMethods,
NELEM(gSurfaceTextureMethods));
}
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 7069d16..f6da660 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3527,11 +3527,6 @@
<!-- Description of the unlock handle in the Slide unlock screen for tablets. [CHAR LIMIT=NONE] -->
<string name="description_target_unlock_tablet">Swipe to unlock.</string>
- <!-- Announce that a headset is required to hear keyboard keys while typing a password. [CHAR LIMIT=NONE] -->
- <string name="keyboard_headset_required_to_hear_password">Plug in a headset to hear password keys spoken.</string>
- <!-- The value of a keyboard key announced when accessibility is enabled and no headsed is used. [CHAR LIMIT=NONE] -->
- <string name="keyboard_password_character_no_headset">Dot.</string>
-
<!-- Content description for the action bar "home" affordance. [CHAR LIMIT=NONE] -->
<string name="action_bar_home_description">Navigate home</string>
<!-- Content description for the action bar "up" affordance. [CHAR LIMIT=NONE] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index b5a5125..db0298a 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -708,8 +708,6 @@
<java-symbol type="string" name="js_dialog_before_unload" />
<java-symbol type="string" name="js_dialog_title" />
<java-symbol type="string" name="js_dialog_title_default" />
- <java-symbol type="string" name="keyboard_headset_required_to_hear_password" />
- <java-symbol type="string" name="keyboard_password_character_no_headset" />
<java-symbol type="string" name="keyboardview_keycode_alt" />
<java-symbol type="string" name="keyboardview_keycode_cancel" />
<java-symbol type="string" name="keyboardview_keycode_delete" />
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 76331a8..48435bd 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -305,6 +305,8 @@
Settings.Global.STORAGE_BENCHMARK_INTERVAL,
Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS,
Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL,
+ Settings.Global.SYS_STORAGE_CACHE_MAX_BYTES,
+ Settings.Global.SYS_STORAGE_CACHE_PERCENTAGE,
Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES,
Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE,
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index efb46b90..90bdd81 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -403,11 +403,4 @@
private native int nativeGetQueuedCount();
private native void nativeRelease();
private native boolean nativeIsReleased();
-
- /*
- * We use a class initializer to allow the native code to cache some
- * field offsets.
- */
- private static native void nativeClassInit();
- static { nativeClassInit(); }
}
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index 136f17e..f660e1e 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -98,7 +98,7 @@
<bool name="def_accessibility_script_injection">false</bool>
<!-- Default for Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD -->
- <bool name="def_accessibility_speak_password">false</bool>
+ <bool name="def_accessibility_speak_password">true</bool>
<!-- Default for Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS -->
<string name="def_accessibility_web_content_key_bindings" translatable="false">
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 85c153c..a71db85 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -1654,7 +1654,7 @@
return false;
}
- String oldProviders = (settingValue != null) ? settingValue.getValue() : "";
+ String oldProviders = !settingValue.isNull() ? settingValue.getValue() : "";
int index = oldProviders.indexOf(value);
int end = index + value.length();
@@ -2735,7 +2735,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 139;
+ private static final int SETTINGS_VERSION = 140;
private final int mUserId;
@@ -3186,6 +3186,16 @@
currentVersion = 139;
}
+ if (currentVersion == 139) {
+ // Version 140: Settings.Secure#ACCESSIBILITY_SPEAK_PASSWORD is deprecated and
+ // the user can no longer change the value of this setting through the UI.
+ // Force to true.
+ final SettingsState secureSettings = getSecureSettingsLocked(userId);
+ secureSettings.updateSettingLocked(Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
+ "1", null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ currentVersion = 140;
+ }
+
if (currentVersion != newVersion) {
Slog.wtf("SettingsProvider", "warning: upgrading settings database to version "
+ newVersion + " left it at "
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
index 1518bdc..45f1686 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
@@ -89,7 +89,6 @@
setOnClickListener(mListener);
setOnHoverListener(new LiftToActivateListener(context));
- setAccessibilityDelegate(new ObscureSpeechDelegate(context));
mEnableHaptics = new LockPatternUtils(context).isTactileFeedbackEnabled();
@@ -134,14 +133,6 @@
}
@Override
- public void onDetachedFromWindow() {
- super.onDetachedFromWindow();
-
- // Reset the "announced headset" flag when detached.
- ObscureSpeechDelegate.sAnnouncedHeadset = false;
- }
-
- @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
measureChildren(widthMeasureSpec, heightMeasureSpec);
diff --git a/packages/SystemUI/src/com/android/keyguard/ObscureSpeechDelegate.java b/packages/SystemUI/src/com/android/keyguard/ObscureSpeechDelegate.java
deleted file mode 100644
index 410a43a..0000000
--- a/packages/SystemUI/src/com/android/keyguard/ObscureSpeechDelegate.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.keyguard;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.media.AudioManager;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.view.View;
-import android.view.View.AccessibilityDelegate;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityNodeInfo;
-
-import com.android.internal.R;
-
-/**
- * Accessibility delegate that obscures speech for a view when the user has
- * not turned on the "speak passwords" preference and is not listening
- * through headphones.
- */
-class ObscureSpeechDelegate extends AccessibilityDelegate {
- /** Whether any client has announced the "headset" notification. */
- static boolean sAnnouncedHeadset = false;
-
- private final ContentResolver mContentResolver;
- private final AudioManager mAudioManager;
-
- public ObscureSpeechDelegate(Context context) {
- mContentResolver = context.getContentResolver();
- mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
- }
-
- @Override
- public void sendAccessibilityEvent(View host, int eventType) {
- super.sendAccessibilityEvent(host, eventType);
-
- // Play the "headset required" announcement the first time the user
- // places accessibility focus on a key.
- if ((eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED)
- && !sAnnouncedHeadset && shouldObscureSpeech()) {
- sAnnouncedHeadset = true;
- host.announceForAccessibility(host.getContext().getString(
- R.string.keyboard_headset_required_to_hear_password));
- }
- }
-
- @Override
- public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
- super.onPopulateAccessibilityEvent(host, event);
-
- if ((event.getEventType() != AccessibilityEvent.TYPE_ANNOUNCEMENT)
- && shouldObscureSpeech()) {
- event.getText().clear();
- event.setContentDescription(host.getContext().getString(
- R.string.keyboard_password_character_no_headset));
- }
- }
-
- @Override
- public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
- super.onInitializeAccessibilityNodeInfo(host, info);
-
- if (shouldObscureSpeech()) {
- final Context ctx = host.getContext();
- info.setText(null);
- info.setContentDescription(
- ctx.getString(R.string.keyboard_password_character_no_headset));
- }
- }
-
- @SuppressWarnings("deprecation")
- private boolean shouldObscureSpeech() {
- // The user can optionally force speaking passwords.
- if (Settings.Secure.getIntForUser(mContentResolver,
- Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0, UserHandle.USER_CURRENT) != 0) {
- return false;
- }
-
- // Always speak if the user is listening through headphones.
- if (mAudioManager.isWiredHeadsetOn() || mAudioManager.isBluetoothA2dpOn()) {
- return false;
- }
-
- // Don't speak since this key is used to type a password.
- return true;
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
index 48737f9..c43820d 100644
--- a/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
+++ b/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java
@@ -40,6 +40,7 @@
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
+import android.widget.EditText;
import java.util.ArrayList;
import java.util.Stack;
@@ -306,9 +307,6 @@
int removedCount, int addedCount) {
if (AccessibilityManager.getInstance(mContext).isEnabled() &&
(isFocused() || isSelected() && isShown())) {
- if (!shouldSpeakPasswordsForAccessibility()) {
- beforeText = null;
- }
AccessibilityEvent event =
AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
event.setFromIndex(fromIndex);
@@ -324,48 +322,22 @@
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
- event.setClassName(PasswordTextView.class.getName());
+ event.setClassName(EditText.class.getName());
event.setPassword(true);
}
@Override
- public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
- super.onPopulateAccessibilityEvent(event);
-
- if (shouldSpeakPasswordsForAccessibility()) {
- final CharSequence text = mText;
- if (!TextUtils.isEmpty(text)) {
- event.getText().add(text);
- }
- }
- }
-
- @Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(PasswordTextView.class.getName());
info.setPassword(true);
- if (shouldSpeakPasswordsForAccessibility()) {
- info.setText(mText);
- }
-
info.setEditable(true);
info.setInputType(InputType.TYPE_NUMBER_VARIATION_PASSWORD);
}
- /**
- * @return true if the user has explicitly allowed accessibility services
- * to speak passwords.
- */
- private boolean shouldSpeakPasswordsForAccessibility() {
- return (Settings.Secure.getIntForUser(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0,
- UserHandle.USER_CURRENT_OR_SELF) == 1);
- }
-
private class CharState {
char whichChar;
ValueAnimator textAnimator;
diff --git a/services/autofill/java/com/android/server/autofill/DatasetPicker.java b/services/autofill/java/com/android/server/autofill/DatasetPicker.java
index 3190f60..e25f2ce 100644
--- a/services/autofill/java/com/android/server/autofill/DatasetPicker.java
+++ b/services/autofill/java/com/android/server/autofill/DatasetPicker.java
@@ -30,7 +30,6 @@
import android.widget.ListView;
import android.widget.RemoteViews;
import com.android.internal.R;
-import com.android.internal.R;
import java.util.ArrayList;
import java.util.List;
@@ -48,7 +47,7 @@
private final ArrayAdapter<ViewItem> mAdapter;
- DatasetPicker(Context context, ArraySet<Dataset> datasets, AutoFillId filteredViewId,
+ DatasetPicker(Context context, ArrayList<Dataset> datasets, AutoFillId filteredViewId,
Listener listener) {
super(context);
mListener = listener;
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index 5f348bf..a947b41 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -261,7 +261,6 @@
mPrimaryDisplayDeviceInfo = deviceInfo;
mInfo = null;
- mOverrideDisplayInfo = null;
}
}
diff --git a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
index 06b6f66..6365d15 100644
--- a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java
@@ -59,6 +59,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -1035,14 +1036,22 @@
}
}
+ private File[] getDefaultPermissionFiles() {
+ ArrayList<File> ret = new ArrayList<File>();
+ File dir = new File(Environment.getRootDirectory(), "etc/default-permissions");
+ if (dir.isDirectory() && dir.canRead()) {
+ Collections.addAll(ret, dir.listFiles());
+ }
+ dir = new File(Environment.getVendorDirectory(), "etc/default-permissions");
+ if (dir.isDirectory() && dir.canRead()) {
+ Collections.addAll(ret, dir.listFiles());
+ }
+ return ret.isEmpty() ? null : ret.toArray(new File[0]);
+ }
+
private @NonNull ArrayMap<String, List<DefaultPermissionGrant>>
readDefaultPermissionExceptionsLPw() {
- File dir = new File(Environment.getRootDirectory(), "etc/default-permissions");
- if (!dir.exists() || !dir.isDirectory() || !dir.canRead()) {
- return new ArrayMap<>(0);
- }
-
- File[] files = dir.listFiles();
+ File[] files = getDefaultPermissionFiles();
if (files == null) {
return new ArrayMap<>(0);
}
@@ -1052,7 +1061,7 @@
// Iterate over the files in the directory and scan .xml files
for (File file : files) {
if (!file.getPath().endsWith(".xml")) {
- Slog.i(TAG, "Non-xml file " + file + " in " + dir + " directory, ignoring");
+ Slog.i(TAG, "Non-xml file " + file + " in " + file.getParent() + " directory, ignoring");
continue;
}
if (!file.canRead()) {
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 8f38be8..2c315445 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -919,10 +919,6 @@
void updateDisplayInfo() {
mDisplay.getDisplayInfo(mDisplayInfo);
mDisplay.getMetrics(mDisplayMetrics);
-
- // Check if display metrics changed and update base values if needed.
- updateBaseDisplayMetricsIfNeeded();
-
for (int i = mTaskStackContainers.size() - 1; i >= 0; --i) {
mTaskStackContainers.get(i).updateDisplayInfo(null);
}
@@ -938,8 +934,10 @@
}
}
- updateBaseDisplayMetrics(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight,
- mDisplayInfo.logicalDensityDpi);
+ mBaseDisplayWidth = mInitialDisplayWidth = mDisplayInfo.logicalWidth;
+ mBaseDisplayHeight = mInitialDisplayHeight = mDisplayInfo.logicalHeight;
+ mBaseDisplayDensity = mInitialDisplayDensity = mDisplayInfo.logicalDensityDpi;
+ mBaseDisplayRect.set(0, 0, mBaseDisplayWidth, mBaseDisplayHeight);
}
void getLogicalDisplayRect(Rect out) {
@@ -969,30 +967,6 @@
}
}
- /** If display metrics changed and it's not just a rotation - update base values. */
- private void updateBaseDisplayMetricsIfNeeded() {
- final int orientation = mDisplayInfo.rotation;
- final boolean rotated = (orientation == ROTATION_90 || orientation == ROTATION_270);
- final int newWidth = rotated ? mDisplayInfo.logicalHeight : mDisplayInfo.logicalWidth;
- final int newHeight = rotated ? mDisplayInfo.logicalWidth : mDisplayInfo.logicalHeight;
-
- boolean displayMetricsChanged
- = mBaseDisplayWidth != newWidth || mBaseDisplayHeight != newHeight;
- displayMetricsChanged |= mBaseDisplayDensity != mDisplayInfo.logicalDensityDpi;
-
- if (displayMetricsChanged) {
- updateBaseDisplayMetrics(newWidth, newHeight, mDisplayInfo.logicalDensityDpi);
- mService.reconfigureDisplayLocked(this);
- }
- }
-
- void updateBaseDisplayMetrics(int baseWidth, int baseHeight, int baseDensity) {
- mBaseDisplayWidth = mInitialDisplayWidth = baseWidth;
- mBaseDisplayHeight = mInitialDisplayHeight = baseHeight;
- mBaseDisplayDensity = mInitialDisplayDensity = baseDensity;
- mBaseDisplayRect.set(0, 0, mBaseDisplayWidth, mBaseDisplayHeight);
- }
-
void getContentRect(Rect out) {
out.set(mContentRect);
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 03ebf19..9397c9e 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -5888,8 +5888,8 @@
if (displayContent.mBaseDisplayWidth != width
|| displayContent.mBaseDisplayHeight != height) {
Slog.i(TAG_WM, "FORCED DISPLAY SIZE: " + width + "x" + height);
- displayContent.updateBaseDisplayMetrics(width, height,
- displayContent.mBaseDisplayDensity);
+ displayContent.mBaseDisplayWidth = width;
+ displayContent.mBaseDisplayHeight = height;
}
} catch (NumberFormatException ex) {
}
@@ -5914,7 +5914,8 @@
// displayContent must not be null
private void setForcedDisplaySizeLocked(DisplayContent displayContent, int width, int height) {
Slog.i(TAG_WM, "Using new display size: " + width + "x" + height);
- displayContent.updateBaseDisplayMetrics(width, height, displayContent.mBaseDisplayDensity);
+ displayContent.mBaseDisplayWidth = width;
+ displayContent.mBaseDisplayHeight = height;
reconfigureDisplayLocked(displayContent);
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c2c724f..7c9c0e8 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -5522,6 +5522,44 @@
}
/**
+ * Set SIM card power state. Request is equivalent to inserting or removing the card.
+ *
+ * @param powerUp True if powering up the SIM, otherwise powering down
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ *
+ * @hide
+ **/
+ public void setSimPowerState(boolean powerUp) {
+ setSimPowerStateForSlot(getDefaultSim(), powerUp);
+ }
+
+ /**
+ * Set SIM card power state. Request is equivalent to inserting or removing the card.
+ *
+ * @param slotId SIM slot id
+ * @param powerUp True if powering up the SIM, otherwise powering down
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
+ *
+ * @hide
+ **/
+ public void setSimPowerStateForSlot(int slotId, boolean powerUp) {
+ try {
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ telephony.setSimPowerStateForSlot(slotId, powerUp);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#setSimPowerStateForSlot", e);
+ } catch (SecurityException e) {
+ Log.e(TAG, "Permission error calling ITelephony#setSimPowerStateForSlot", e);
+ }
+ }
+
+ /**
* Set baseband version for the default phone.
*
* @param version baseband version
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index e6a6178..88daf64 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1287,4 +1287,12 @@
* @hide
*/
List<ClientRequestStats> getClientRequestStats(String callingPackage, int subid);
+
+ /**
+ * Set SIM card power state. Request is equivalent to inserting or removing the card.
+ * @param slotId SIM slot id
+ * @param powerUp True if powering up the SIM, otherwise powering down
+ * @hide
+ * */
+ void setSimPowerStateForSlot(int slotId, boolean powerUp);
}