diff options
21 files changed, 219 insertions, 23 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index d84b1dc..c6d7364 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5327,6 +5327,7 @@ package android.app { public class WallpaperManager { method public void clear() throws java.io.IOException; + method public void clearWallpaper(); method public void clearWallpaperOffsets(android.os.IBinder); method public void forgetLoadedWallpaper(); method public android.graphics.drawable.Drawable getBuiltInDrawable(); @@ -5347,6 +5348,7 @@ package android.app { method public void setDisplayPadding(android.graphics.Rect); method public void setResource(int) throws java.io.IOException; method public void setStream(java.io.InputStream) throws java.io.IOException; + method public boolean setWallpaperComponent(android.content.ComponentName); method public void setWallpaperOffsetSteps(float, float); method public void setWallpaperOffsets(android.os.IBinder, float, float); method public void suggestDesiredDimensions(int, int); @@ -26872,6 +26874,7 @@ package android.provider { field public static final java.lang.String SHOW_PROCESSES = "show_processes"; field public static final java.lang.String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in"; field public static final java.lang.String SYS_PROP_SETTING_VERSION = "sys.settings_global_version"; + field public static final java.lang.String THEATER_MODE_ON = "theater_mode_on"; field public static final java.lang.String TRANSITION_ANIMATION_SCALE = "transition_animation_scale"; field public static final java.lang.String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled"; field public static final java.lang.String USE_GOOGLE_MAIL = "use_google_mail"; @@ -36910,8 +36913,10 @@ package android.view { method public java.lang.String debug(java.lang.String); method public int describeContents(); method public final java.lang.CharSequence getTitle(); + method public final long getUserActivityTimeout(); method public static boolean mayUseInputMethod(int); method public final void setTitle(java.lang.CharSequence); + method public final void setUserActivityTimeout(long); method public void writeToParcel(android.os.Parcel, int); field public static final int ALPHA_CHANGED = 128; // 0x80 field public static final int ANIMATION_CHANGED = 16; // 0x10 diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index 8bfe6d3..90d84ee 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -994,6 +994,47 @@ public class WallpaperManager { } /** + * Clear the wallpaper. + * + * @hide + */ + @SystemApi + public void clearWallpaper() { + if (sGlobals.mService == null) { + Log.w(TAG, "WallpaperService not running"); + return; + } + try { + sGlobals.mService.clearWallpaper(); + } catch (RemoteException e) { + // Ignore + } + } + + /** + * Set the live wallpaper. + * + * This can only be called by packages with android.permission.SET_WALLPAPER_COMPONENT + * permission. + * + * @hide + */ + @SystemApi + public boolean setWallpaperComponent(ComponentName name) { + if (sGlobals.mService == null) { + Log.w(TAG, "WallpaperService not running"); + return false; + } + try { + sGlobals.mService.setWallpaperComponent(name); + return true; + } catch (RemoteException e) { + // Ignore + } + return false; + } + + /** * Set the position of the current wallpaper within any larger space, when * that wallpaper is visible behind the given window. The X and Y offsets * are floating point numbers ranging from 0 to 1, representing where the diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 1ed709b..cf06cb7 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -2933,9 +2933,9 @@ public class DevicePolicyManager { * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param packageNames List of input method package names. - * @return true if setting the restriction succeeded. It will fail if there is - * one or more input method enabled, that are not in the list or user if the foreground - * user. + * @return true if setting the restriction succeeded. It will fail if there are + * one or more non-system input methods currently enabled that are not in + * the packageNames list. */ public boolean setPermittedInputMethods(ComponentName admin, List<String> packageNames) { if (mService != null) { diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index bedc695..3d5215b 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -276,7 +276,7 @@ public final class Parcel { private static native byte[] nativeMarshall(long nativePtr); private static native void nativeUnmarshall( - long nativePtr, byte[] data, int offest, int length); + long nativePtr, byte[] data, int offset, int length); private static native void nativeAppendFrom( long thisNativePtr, long otherNativePtr, int offset, int length); private static native boolean nativeHasFileDescriptors(long nativePtr); @@ -438,8 +438,8 @@ public final class Parcel { /** * Set the bytes in data to be the raw bytes of this Parcel. */ - public final void unmarshall(byte[] data, int offest, int length) { - nativeUnmarshall(mNativePtr, data, offest, length); + public final void unmarshall(byte[] data, int offset, int length) { + nativeUnmarshall(mNativePtr, data, offset, length); } public final void appendFrom(Parcel parcel, int offset, int length) { diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 8307d9b..d52dd30 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -835,6 +835,21 @@ public final class PowerManager { } /** + * Turn off the device. + * + * @param confirm If true, shows a shutdown confirmation dialog. + * @param wait If true, this call waits for the shutdown to complete and does not return. + * + * @hide + */ + public void shutdown(boolean confirm, boolean wait) { + try { + mService.shutdown(confirm, wait); + } catch (RemoteException e) { + } + } + + /** * Intent that is broadcast when the state of {@link #isPowerSaveMode()} changes. * This broadcast is only sent to registered receivers. */ diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 838686a..92349338 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -5101,6 +5101,7 @@ public final class Settings { * Whether Theater Mode is on. * {@hide} */ + @SystemApi public static final String THEATER_MODE_ON = "theater_mode_on"; /** diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index 2b53c48..b84c3aa 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -1754,8 +1754,8 @@ public abstract class Layout { private char getEllipsisChar(TextUtils.TruncateAt method) { return (method == TextUtils.TruncateAt.END_SMALL) ? - ELLIPSIS_TWO_DOTS[0] : - ELLIPSIS_NORMAL[0]; + TextUtils.ELLIPSIS_TWO_DOTS[0] : + TextUtils.ELLIPSIS_NORMAL[0]; } private void ellipsize(int start, int end, int line, @@ -1952,6 +1952,4 @@ public abstract class Layout { /* package */ static final Directions DIRS_ALL_RIGHT_TO_LEFT = new Directions(new int[] { 0, RUN_LENGTH_MASK | RUN_RTL_FLAG }); - /* package */ static final char[] ELLIPSIS_NORMAL = { '\u2026' }; // this is "..." - /* package */ static final char[] ELLIPSIS_TWO_DOTS = { '\u2025' }; // this is ".." } diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java index 74b7b69..07505a9 100644 --- a/core/java/android/text/StaticLayout.java +++ b/core/java/android/text/StaticLayout.java @@ -652,7 +652,7 @@ public class StaticLayout extends Layout { float ellipsisWidth = paint.measureText( (where == TextUtils.TruncateAt.END_SMALL) ? - ELLIPSIS_TWO_DOTS : ELLIPSIS_NORMAL, 0, 1); + TextUtils.ELLIPSIS_TWO_DOTS : TextUtils.ELLIPSIS_NORMAL, 0, 1); int ellipsisStart = 0; int ellipsisCount = 0; int len = lineEnd - lineStart; diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index 8a8c6d8..48bb5dd 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -63,9 +63,12 @@ import java.util.regex.Pattern; public class TextUtils { private static final String TAG = "TextUtils"; - private static final String ELLIPSIS = new String(Layout.ELLIPSIS_NORMAL); - private static final String ELLIPSIS_TWO_DOTS = new String(Layout.ELLIPSIS_TWO_DOTS); + /* package */ static final char[] ELLIPSIS_NORMAL = { '\u2026' }; // this is "..." + private static final String ELLIPSIS_STRING = new String(ELLIPSIS_NORMAL); + + /* package */ static final char[] ELLIPSIS_TWO_DOTS = { '\u2025' }; // this is ".." + private static final String ELLIPSIS_TWO_DOTS_STRING = new String(ELLIPSIS_TWO_DOTS); private TextUtils() { /* cannot be instantiated */ } @@ -1085,7 +1088,7 @@ public class TextUtils { EllipsizeCallback callback) { return ellipsize(text, paint, avail, where, preserveLength, callback, TextDirectionHeuristics.FIRSTSTRONG_LTR, - (where == TruncateAt.END_SMALL) ? ELLIPSIS_TWO_DOTS : ELLIPSIS); + (where == TruncateAt.END_SMALL) ? ELLIPSIS_TWO_DOTS_STRING : ELLIPSIS_STRING); } /** diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 6928b2c..3c05872 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8440,8 +8440,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // If the event should be handled by accessibility focus first. if (event.isTargetAccessibilityFocus()) { // We don't have focus or no virtual descendant has it, do not handle the event. - if (!isAccessibilityFocused() && !(getViewRootImpl() != null && getViewRootImpl() - .getAccessibilityFocusedHost() == this)) { + if (!isAccessibilityFocusedViewOrHost()) { return false; } // We have focus and got the event, then use normal event dispatch. @@ -8490,6 +8489,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return result; } + boolean isAccessibilityFocusedViewOrHost() { + return isAccessibilityFocused() || (getViewRootImpl() != null && getViewRootImpl() + .getAccessibilityFocusedHost() == this); + } + /** * Filter the touch event to apply security policies. * @@ -12872,7 +12876,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Interpolator.Result.FREEZE_END) { cache.state = ScrollabilityCache.OFF; } else { - cache.scrollBar.setAlpha(Math.round(values[0])); + cache.scrollBar.mutate().setAlpha(Math.round(values[0])); } // This will make the scroll bars inval themselves after @@ -12882,7 +12886,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } else { // We're just on -- but we may have been fading before so // reset alpha - cache.scrollBar.setAlpha(255); + cache.scrollBar.mutate().setAlpha(255); } diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index fd50c4d..7a36eb6 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -1934,6 +1934,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // Whether this event should be handled by the accessibility focus first. final boolean targetAccessibilityFocus = ev.isTargetAccessibilityFocus(); + // If the event targets the accessibility focused view and this is it, start + // normal event dispatch. Maybe a descendant is what will handle the click. + if (targetAccessibilityFocus && isAccessibilityFocusedViewOrHost()) { + ev.setTargetAccessibilityFocus(false); + } + boolean handled = false; if (onFilterTouchEventForSecurity(ev)) { final int action = ev.getAction(); @@ -2681,6 +2687,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @Override void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); + if (getAccessibilityNodeProvider() != null) { + return; + } if (mAttachInfo != null) { final ArrayList<View> childrenForAccessibility = mAttachInfo.mTempArrayList; childrenForAccessibility.clear(); diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 094a8a1..84434f7 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -16,6 +16,7 @@ package android.view; +import android.annotation.SystemApi; import android.app.Presentation; import android.content.Context; import android.content.pm.ActivityInfo; @@ -1590,7 +1591,19 @@ public interface WindowManager extends ViewManager { public final CharSequence getTitle() { return mTitle; } - + + /** @hide */ + @SystemApi + public final void setUserActivityTimeout(long timeout) { + userActivityTimeout = timeout; + } + + /** @hide */ + @SystemApi + public final long getUserActivityTimeout() { + return userActivityTimeout; + } + public int describeContents() { return 0; } diff --git a/core/java/android/widget/ScrollBarDrawable.java b/core/java/android/widget/ScrollBarDrawable.java index 10e9ff4..8eff1aa 100644 --- a/core/java/android/widget/ScrollBarDrawable.java +++ b/core/java/android/widget/ScrollBarDrawable.java @@ -44,6 +44,7 @@ public class ScrollBarDrawable extends Drawable { private final Rect mTempBounds = new Rect(); private boolean mAlwaysDrawHorizontalTrack; private boolean mAlwaysDrawVerticalTrack; + private boolean mMutated; public ScrollBarDrawable() { } @@ -191,6 +192,9 @@ public class ScrollBarDrawable extends Drawable { public void setVerticalThumbDrawable(Drawable thumb) { if (thumb != null) { + if (mMutated) { + thumb.mutate(); + } thumb.setState(STATE_ENABLED); mVerticalThumb = thumb; } @@ -198,6 +202,9 @@ public class ScrollBarDrawable extends Drawable { public void setVerticalTrackDrawable(Drawable track) { if (track != null) { + if (mMutated) { + track.mutate(); + } track.setState(STATE_ENABLED); } mVerticalTrack = track; @@ -205,6 +212,9 @@ public class ScrollBarDrawable extends Drawable { public void setHorizontalThumbDrawable(Drawable thumb) { if (thumb != null) { + if (mMutated) { + thumb.mutate(); + } thumb.setState(STATE_ENABLED); mHorizontalThumb = thumb; } @@ -212,6 +222,9 @@ public class ScrollBarDrawable extends Drawable { public void setHorizontalTrackDrawable(Drawable track) { if (track != null) { + if (mMutated) { + track.mutate(); + } track.setState(STATE_ENABLED); } mHorizontalTrack = track; @@ -228,6 +241,26 @@ public class ScrollBarDrawable extends Drawable { } @Override + public ScrollBarDrawable mutate() { + if (!mMutated && super.mutate() == this) { + if (mVerticalTrack != null) { + mVerticalTrack.mutate(); + } + if (mVerticalThumb != null) { + mVerticalThumb.mutate(); + } + if (mHorizontalTrack != null) { + mHorizontalTrack.mutate(); + } + if (mHorizontalThumb != null) { + mHorizontalThumb.mutate(); + } + mMutated = true; + } + return this; + } + + @Override public void setAlpha(int alpha) { if (mVerticalTrack != null) { mVerticalTrack.setAlpha(alpha); diff --git a/core/res/res/layout/preference_dialog_edittext_material.xml b/core/res/res/layout/preference_dialog_edittext_material.xml new file mode 100644 index 0000000..df76f7f --- /dev/null +++ b/core/res/res/layout/preference_dialog_edittext_material.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2015 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- Layout used as the dialog's content View for EditTextPreference. --> +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="48dp" + android:layout_marginBottom="48dp" + android:overScrollMode="ifContentScrolls"> + + <LinearLayout + android:id="@+id/edittext_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="20dp" + android:orientation="vertical"> + + <TextView + android:id="@+id/message" + android:layout_marginBottom="48dp" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="4dp" + android:paddingEnd="4dp" + android:textColor="?attr/textColorSecondary" + style="?attr/textAppearanceSmall" /> + + </LinearLayout> + +</ScrollView> diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml index 3eede32..307a1ea 100644 --- a/core/res/res/values-watch/config.xml +++ b/core/res/res/values-watch/config.xml @@ -23,7 +23,7 @@ <!-- Only show settings item due to smaller real estate. --> <string-array translatable="false" name="config_globalActionsList"> - <item>settings</item> + <item>voiceassist</item> </string-array> <!-- Base "touch slop" value used by ViewConfiguration as a diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 20b4b62..d30d36e 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -482,6 +482,9 @@ <!-- label for item that launches settings in phone options dialog [CHAR LIMIT=15]--> <string name="global_action_settings">Settings</string> + <!-- label for item that launches voice assist in phone options dialog [CHAR LIMIT=15]--> + <string name="global_action_voice_assist">Voice Assist</string> + <!-- label for item that locks the phone and enforces that it can't be unlocked without entering a credential. [CHAR LIMIT=15] --> <string name="global_action_lockdown">Lock now</string> diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 6220a1b..419beba 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -88,7 +88,7 @@ please see styles_device_defaults.xml. </style> <style name="Preference.Material.DialogPreference.EditTextPreference"> - <item name="dialogLayout">@layout/preference_dialog_edittext</item> + <item name="dialogLayout">@layout/preference_dialog_edittext_material</item> </style> <style name="Preference.Material.RingtonePreference"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 1055547..77c981a 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1527,6 +1527,7 @@ <java-symbol type="string" name="global_action_silent_mode_on_status" /> <java-symbol type="string" name="global_action_toggle_silent_mode" /> <java-symbol type="string" name="global_action_lockdown" /> + <java-symbol type="string" name="global_action_voice_assist" /> <java-symbol type="string" name="invalidPuk" /> <java-symbol type="string" name="lockscreen_carrier_default" /> <java-symbol type="style" name="Animation.LockScreen" /> @@ -1614,6 +1615,7 @@ <java-symbol type="drawable" name="ic_notification_ime_default" /> <java-symbol type="drawable" name="ic_menu_refresh" /> <java-symbol type="drawable" name="ic_settings" /> + <java-symbol type="drawable" name="ic_voice_search" /> <java-symbol type="drawable" name="stat_notify_car_mode" /> <java-symbol type="drawable" name="stat_notify_disabled_data" /> <java-symbol type="drawable" name="stat_notify_disk_full" /> diff --git a/media/java/android/media/ClosedCaptionRenderer.java b/media/java/android/media/ClosedCaptionRenderer.java index ec33c5c..d34b21b 100644 --- a/media/java/android/media/ClosedCaptionRenderer.java +++ b/media/java/android/media/ClosedCaptionRenderer.java @@ -666,7 +666,7 @@ class CCParser { if (pac.isIndentPAC()) { moveCursorTo(pac.getRow(), pac.getCol()); } else { - moveCursorToRow(pac.getRow()); + moveCursorTo(pac.getRow(), 1); } getLineBuffer(mRow).setPACAt(mCol, pac); } diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index b0b2886..20a2c9f 100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java @@ -100,6 +100,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private static final String GLOBAL_ACTION_KEY_USERS = "users"; private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings"; private static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown"; + private static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist"; private final Context mContext; private final WindowManagerFuncs mWindowManagerFuncs; @@ -291,6 +292,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mItems.add(getSettingsAction()); } else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey)) { mItems.add(getLockdownAction()); + } else if (GLOBAL_ACTION_KEY_VOICEASSIST.equals(actionKey)) { + mItems.add(getVoiceAssistAction()); } else { Log.e(TAG, "Invalid global action key " + actionKey); } @@ -436,6 +439,28 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }; } + private Action getVoiceAssistAction() { + return new SinglePressAction(com.android.internal.R.drawable.ic_voice_search, + R.string.global_action_voice_assist) { + @Override + public void onPress() { + Intent intent = new Intent(Intent.ACTION_VOICE_ASSIST); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + mContext.startActivity(intent); + } + + @Override + public boolean showDuringKeyguard() { + return true; + } + + @Override + public boolean showBeforeProvisioning() { + return true; + } + }; + } + private Action getLockdownAction() { return new SinglePressAction(com.android.internal.R.drawable.ic_lock_lock, R.string.global_action_lockdown) { diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index f3b7129..c043659 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1815,7 +1815,7 @@ public class PhoneNumberUtils // to the list. number = extractNetworkPortionAlt(number); - Rlog.d(LOG_TAG, "subId:" + subId + ", number: " + number + ", defaultCountryIso:" + + Rlog.d(LOG_TAG, "subId:" + subId + ", defaultCountryIso:" + ((defaultCountryIso == null) ? "NULL" : defaultCountryIso)); String emergencyNumbers = ""; |
