diff options
206 files changed, 2367 insertions, 615 deletions
diff --git a/Android.mk b/Android.mk index 2673cd8b7ac8..137ef85dc594 100644 --- a/Android.mk +++ b/Android.mk @@ -713,8 +713,6 @@ framework_docs_LOCAL_SRC_FILES := \ $(filter-out $(patterns_to_not_document), $(call find-other-java-files, $(dirs_to_document))) \ $(common_src_files) -# $(call find-other-java-files, $(dirs_to_document)) \ - # These are relative to frameworks/base framework_docs_LOCAL_API_CHECK_SRC_FILES := \ $(call find-other-java-files, $(dirs_to_check_apis)) \ diff --git a/api/current.txt b/api/current.txt index 7b2e27333ddb..e0dfb6c5e0b8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28068,8 +28068,9 @@ package android.os { method public boolean isSystemUser(); method public boolean isUserAGoat(); method public boolean isUserRunning(android.os.UserHandle); + method public boolean isUserRunningAndLocked(android.os.UserHandle); + method public boolean isUserRunningAndUnlocked(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); - method public boolean isUserRunningUnlocked(android.os.UserHandle); method public deprecated boolean setRestrictionsChallenge(java.lang.String); method public deprecated void setUserRestriction(java.lang.String, boolean); method public deprecated void setUserRestrictions(android.os.Bundle); @@ -29635,6 +29636,7 @@ package android.provider { ctor public ContactsContract.CommonDataKinds.Callable(); field public static final android.net.Uri CONTENT_FILTER_URI; field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -29781,6 +29783,7 @@ package android.provider { field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2"; field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -29960,7 +29963,7 @@ package android.provider { field public static final android.net.Uri CONTENT_URI; field public static final java.lang.String CONTENT_VCARD_TYPE = "text/x-vcard"; field public static final android.net.Uri CONTENT_VCARD_URI; - field public static final android.net.Uri CORP_CONTENT_FILTER_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -30089,10 +30092,12 @@ package android.provider { field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_directory"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact_directories"; field public static final android.net.Uri CONTENT_URI; - field public static final android.net.Uri CORP_CONTENT_URI; field public static final long DEFAULT = 0L; // 0x0L field public static final java.lang.String DIRECTORY_AUTHORITY = "authority"; field public static final java.lang.String DISPLAY_NAME = "displayName"; + field public static final android.net.Uri ENTERPRISE_CONTENT_URI; + field public static final long ENTERPRISE_DEFAULT = 1000000000L; // 0x3b9aca00L + field public static final long ENTERPRISE_LOCAL_INVISIBLE = 1000000001L; // 0x3b9aca01L field public static final java.lang.String EXPORT_SUPPORT = "exportSupport"; field public static final int EXPORT_SUPPORT_ANY_ACCOUNT = 2; // 0x2 field public static final int EXPORT_SUPPORT_NONE = 0; // 0x0 @@ -30439,6 +30444,7 @@ package android.provider { field public static final java.lang.String COLUMN_MIME_TYPE = "mime_type"; field public static final java.lang.String COLUMN_SIZE = "_size"; field public static final java.lang.String COLUMN_SUMMARY = "summary"; + field public static final int FLAG_ARCHIVE = 2048; // 0x800 field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10 field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20 field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8 @@ -38651,10 +38657,11 @@ package android.util { field public static final int RTL = 1; // 0x1 } - public final class LocaleList { + public final class LocaleList implements android.os.Parcelable { ctor public LocaleList(); ctor public LocaleList(java.util.Locale); ctor public LocaleList(java.util.Locale[]); + method public int describeContents(); method public static android.util.LocaleList forLanguageTags(java.lang.String); method public java.util.Locale get(int); method public java.util.Locale getBestMatch(java.lang.String[]); @@ -38664,6 +38671,8 @@ package android.util { method public boolean isEmpty(); method public int size(); method public java.lang.String toLanguageTags(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.util.LocaleList> CREATOR; } public final class Log { @@ -42947,6 +42956,7 @@ package android.view.inputmethod { field public int initialSelStart; field public int inputType; field public java.lang.CharSequence label; + field public android.util.LocaleList locales; field public java.lang.String packageName; field public java.lang.String privateImeOptions; } @@ -64085,4 +64095,3 @@ package org.xmlpull.v1.sax2 { } } - diff --git a/api/system-current.txt b/api/system-current.txt index 65dbc50ad375..f8d095393e77 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -25528,10 +25528,12 @@ package android.net.wifi { field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo"; field public static final java.lang.String EXTRA_NEW_RSSI = "newRssi"; field public static final java.lang.String EXTRA_NEW_STATE = "newState"; + field public static final java.lang.String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state"; field public static final java.lang.String EXTRA_PREVIOUS_WIFI_STATE = "previous_wifi_state"; field public static final java.lang.String EXTRA_RESULTS_UPDATED = "resultsUpdated"; field public static final java.lang.String EXTRA_SUPPLICANT_CONNECTED = "connected"; field public static final java.lang.String EXTRA_SUPPLICANT_ERROR = "supplicantError"; + field public static final java.lang.String EXTRA_WIFI_AP_STATE = "wifi_state"; field public static final java.lang.String EXTRA_WIFI_CONFIGURATION = "wifiConfiguration"; field public static final java.lang.String EXTRA_WIFI_CREDENTIAL_EVENT_TYPE = "et"; field public static final java.lang.String EXTRA_WIFI_CREDENTIAL_SSID = "ssid"; @@ -25543,6 +25545,12 @@ package android.net.wifi { field public static final java.lang.String SCAN_RESULTS_AVAILABLE_ACTION = "android.net.wifi.SCAN_RESULTS"; field public static final java.lang.String SUPPLICANT_CONNECTION_CHANGE_ACTION = "android.net.wifi.supplicant.CONNECTION_CHANGE"; field public static final java.lang.String SUPPLICANT_STATE_CHANGED_ACTION = "android.net.wifi.supplicant.STATE_CHANGE"; + field public static final java.lang.String WIFI_AP_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_AP_STATE_CHANGED"; + field public static final int WIFI_AP_STATE_DISABLED = 11; // 0xb + field public static final int WIFI_AP_STATE_DISABLING = 10; // 0xa + field public static final int WIFI_AP_STATE_ENABLED = 13; // 0xd + field public static final int WIFI_AP_STATE_ENABLING = 12; // 0xc + field public static final int WIFI_AP_STATE_FAILED = 14; // 0xe field public static final java.lang.String WIFI_CREDENTIAL_CHANGED_ACTION = "android.net.wifi.WIFI_CREDENTIAL_CHANGED"; field public static final int WIFI_CREDENTIAL_FORGOT = 1; // 0x1 field public static final int WIFI_CREDENTIAL_SAVED = 0; // 0x0 @@ -30053,8 +30061,9 @@ package android.os { method public boolean isSystemUser(); method public boolean isUserAGoat(); method public boolean isUserRunning(android.os.UserHandle); + method public boolean isUserRunningAndLocked(android.os.UserHandle); + method public boolean isUserRunningAndUnlocked(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); - method public boolean isUserRunningUnlocked(android.os.UserHandle); method public deprecated boolean setRestrictionsChallenge(java.lang.String); method public deprecated void setUserRestriction(java.lang.String, boolean); method public deprecated void setUserRestrictions(android.os.Bundle); @@ -31620,6 +31629,7 @@ package android.provider { ctor public ContactsContract.CommonDataKinds.Callable(); field public static final android.net.Uri CONTENT_FILTER_URI; field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -31766,6 +31776,7 @@ package android.provider { field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2"; field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -31945,7 +31956,7 @@ package android.provider { field public static final android.net.Uri CONTENT_URI; field public static final java.lang.String CONTENT_VCARD_TYPE = "text/x-vcard"; field public static final android.net.Uri CONTENT_VCARD_URI; - field public static final android.net.Uri CORP_CONTENT_FILTER_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -32074,10 +32085,12 @@ package android.provider { field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_directory"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact_directories"; field public static final android.net.Uri CONTENT_URI; - field public static final android.net.Uri CORP_CONTENT_URI; field public static final long DEFAULT = 0L; // 0x0L field public static final java.lang.String DIRECTORY_AUTHORITY = "authority"; field public static final java.lang.String DISPLAY_NAME = "displayName"; + field public static final android.net.Uri ENTERPRISE_CONTENT_URI; + field public static final long ENTERPRISE_DEFAULT = 1000000000L; // 0x3b9aca00L + field public static final long ENTERPRISE_LOCAL_INVISIBLE = 1000000001L; // 0x3b9aca01L field public static final java.lang.String EXPORT_SUPPORT = "exportSupport"; field public static final int EXPORT_SUPPORT_ANY_ACCOUNT = 2; // 0x2 field public static final int EXPORT_SUPPORT_NONE = 0; // 0x0 @@ -32454,6 +32467,7 @@ package android.provider { field public static final java.lang.String COLUMN_MIME_TYPE = "mime_type"; field public static final java.lang.String COLUMN_SIZE = "_size"; field public static final java.lang.String COLUMN_SUMMARY = "summary"; + field public static final int FLAG_ARCHIVE = 2048; // 0x800 field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10 field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20 field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8 @@ -40977,10 +40991,11 @@ package android.util { field public static final int RTL = 1; // 0x1 } - public final class LocaleList { + public final class LocaleList implements android.os.Parcelable { ctor public LocaleList(); ctor public LocaleList(java.util.Locale); ctor public LocaleList(java.util.Locale[]); + method public int describeContents(); method public static android.util.LocaleList forLanguageTags(java.lang.String); method public java.util.Locale get(int); method public java.util.Locale getBestMatch(java.lang.String[]); @@ -40990,6 +41005,8 @@ package android.util { method public boolean isEmpty(); method public int size(); method public java.lang.String toLanguageTags(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.util.LocaleList> CREATOR; } public final class Log { @@ -45276,6 +45293,7 @@ package android.view.inputmethod { field public int initialSelStart; field public int inputType; field public java.lang.CharSequence label; + field public android.util.LocaleList locales; field public java.lang.String packageName; field public java.lang.String privateImeOptions; } diff --git a/api/test-current.txt b/api/test-current.txt index 598924b5725b..1338d90345d6 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -28068,8 +28068,9 @@ package android.os { method public boolean isSystemUser(); method public boolean isUserAGoat(); method public boolean isUserRunning(android.os.UserHandle); + method public boolean isUserRunningAndLocked(android.os.UserHandle); + method public boolean isUserRunningAndUnlocked(android.os.UserHandle); method public boolean isUserRunningOrStopping(android.os.UserHandle); - method public boolean isUserRunningUnlocked(android.os.UserHandle); method public deprecated boolean setRestrictionsChallenge(java.lang.String); method public deprecated void setUserRestriction(java.lang.String, boolean); method public deprecated void setUserRestrictions(android.os.Bundle); @@ -29637,6 +29638,7 @@ package android.provider { ctor public ContactsContract.CommonDataKinds.Callable(); field public static final android.net.Uri CONTENT_FILTER_URI; field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -29783,6 +29785,7 @@ package android.provider { field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2"; field public static final android.net.Uri CONTENT_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -29962,7 +29965,7 @@ package android.provider { field public static final android.net.Uri CONTENT_URI; field public static final java.lang.String CONTENT_VCARD_TYPE = "text/x-vcard"; field public static final android.net.Uri CONTENT_VCARD_URI; - field public static final android.net.Uri CORP_CONTENT_FILTER_URI; + field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS"; field public static final java.lang.String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES"; @@ -30091,10 +30094,12 @@ package android.provider { field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_directory"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/contact_directories"; field public static final android.net.Uri CONTENT_URI; - field public static final android.net.Uri CORP_CONTENT_URI; field public static final long DEFAULT = 0L; // 0x0L field public static final java.lang.String DIRECTORY_AUTHORITY = "authority"; field public static final java.lang.String DISPLAY_NAME = "displayName"; + field public static final android.net.Uri ENTERPRISE_CONTENT_URI; + field public static final long ENTERPRISE_DEFAULT = 1000000000L; // 0x3b9aca00L + field public static final long ENTERPRISE_LOCAL_INVISIBLE = 1000000001L; // 0x3b9aca01L field public static final java.lang.String EXPORT_SUPPORT = "exportSupport"; field public static final int EXPORT_SUPPORT_ANY_ACCOUNT = 2; // 0x2 field public static final int EXPORT_SUPPORT_NONE = 0; // 0x0 @@ -30441,6 +30446,7 @@ package android.provider { field public static final java.lang.String COLUMN_MIME_TYPE = "mime_type"; field public static final java.lang.String COLUMN_SIZE = "_size"; field public static final java.lang.String COLUMN_SUMMARY = "summary"; + field public static final int FLAG_ARCHIVE = 2048; // 0x800 field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10 field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20 field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8 @@ -38653,10 +38659,11 @@ package android.util { field public static final int RTL = 1; // 0x1 } - public final class LocaleList { + public final class LocaleList implements android.os.Parcelable { ctor public LocaleList(); ctor public LocaleList(java.util.Locale); ctor public LocaleList(java.util.Locale[]); + method public int describeContents(); method public static android.util.LocaleList forLanguageTags(java.lang.String); method public java.util.Locale get(int); method public java.util.Locale getBestMatch(java.lang.String[]); @@ -38666,6 +38673,8 @@ package android.util { method public boolean isEmpty(); method public int size(); method public java.lang.String toLanguageTags(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator<android.util.LocaleList> CREATOR; } public final class Log { @@ -42949,6 +42958,7 @@ package android.view.inputmethod { field public int initialSelStart; field public int inputType; field public java.lang.CharSequence label; + field public android.util.LocaleList locales; field public java.lang.String packageName; field public java.lang.String privateImeOptions; } diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 798deb1a590d..96312688d954 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -548,6 +548,10 @@ public class ActivityManager { public static boolean canReceiveKeys(int stackId) { return stackId != PINNED_STACK_ID; } + + public static boolean isAlwaysOnTop(int stackId) { + return stackId == PINNED_STACK_ID; + } } /** @@ -2113,7 +2117,9 @@ public class ActivityManager { public int[] taskIds; public String[] taskNames; public Rect[] taskBounds; + public int[] taskUserIds; public int displayId; + public int userId; @Override public int describeContents() { @@ -2137,7 +2143,9 @@ public class ActivityManager { dest.writeInt(taskBounds[i].right); dest.writeInt(taskBounds[i].bottom); } + dest.writeIntArray(taskUserIds); dest.writeInt(displayId); + dest.writeInt(userId); } public void readFromParcel(Parcel source) { @@ -2157,7 +2165,9 @@ public class ActivityManager { } else { taskBounds = null; } + taskUserIds = source.createIntArray(); displayId = source.readInt(); + userId = source.readInt(); } public static final Creator<StackInfo> CREATOR = new Creator<StackInfo>() { @@ -2183,6 +2193,7 @@ public class ActivityManager { sb.append(prefix); sb.append("Stack id="); sb.append(stackId); sb.append(" bounds="); sb.append(bounds.toShortString()); sb.append(" displayId="); sb.append(displayId); + sb.append(" userId="); sb.append(userId); sb.append("\n"); prefix = prefix + " "; for (int i = 0; i < taskIds.length; ++i) { @@ -2191,6 +2202,7 @@ public class ActivityManager { if (taskBounds != null) { sb.append(" bounds="); sb.append(taskBounds[i].toShortString()); } + sb.append(" userId=").append(taskUserIds[i]); sb.append("\n"); } return sb.toString(); @@ -3108,9 +3120,29 @@ public class ActivityManager { * @param userid the user's id. Zero indicates the default user. * @hide */ - public boolean isUserRunning(int userid) { + public boolean isUserRunning(int userId) { + try { + return ActivityManagerNative.getDefault().isUserRunning(userId, 0); + } catch (RemoteException e) { + return false; + } + } + + /** {@hide} */ + public boolean isUserRunningAndLocked(int userId) { + try { + return ActivityManagerNative.getDefault().isUserRunning(userId, + ActivityManager.FLAG_AND_LOCKED); + } catch (RemoteException e) { + return false; + } + } + + /** {@hide} */ + public boolean isUserRunningAndUnlocked(int userId) { try { - return ActivityManagerNative.getDefault().isUserRunning(userid, 0); + return ActivityManagerNative.getDefault().isUserRunning(userId, + ActivityManager.FLAG_AND_UNLOCKED); } catch (RemoteException e) { return false; } diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 74f0c0e0e1e3..c26436808e41 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4841,7 +4841,7 @@ public final class ActivityThread { if (ii != null) { final ApplicationInfo instrApp = new ApplicationInfo(); ii.copyTo(instrApp); - + instrApp.initForUser(UserHandle.myUserId()); final LoadedApk pi = getPackageInfo(instrApp, data.compatInfo, appContext.getClassLoader(), false, true, false); final ContextImpl instrContext = ContextImpl.createAppContext(this, pi); diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java index 9081ef8a1d1a..984a18615caf 100644 --- a/core/java/android/app/BackStackRecord.java +++ b/core/java/android/app/BackStackRecord.java @@ -798,21 +798,33 @@ final class BackStackRecord extends FragmentTransaction implements } } - private static void setFirstOut(SparseArray<Fragment> fragments, Fragment fragment) { + private static void setFirstOut(SparseArray<Fragment> firstOutFragments, + SparseArray<Fragment> lastInFragments, Fragment fragment) { if (fragment != null) { int containerId = fragment.mContainerId; - if (containerId != 0 && !fragment.isHidden() && fragment.isAdded() && - fragment.getView() != null && fragments.get(containerId) == null) { - fragments.put(containerId, fragment); + if (containerId != 0 && !fragment.isHidden()) { + if (fragment.isAdded() && fragment.getView() != null + && firstOutFragments.get(containerId) == null) { + firstOutFragments.put(containerId, fragment); + } + if (lastInFragments.get(containerId) == fragment) { + lastInFragments.remove(containerId); + } } } } - private void setLastIn(SparseArray<Fragment> fragments, Fragment fragment) { + private void setLastIn(SparseArray<Fragment> firstOutFragments, + SparseArray<Fragment> lastInFragments, Fragment fragment) { if (fragment != null) { int containerId = fragment.mContainerId; if (containerId != 0) { - fragments.put(containerId, fragment); + if (!fragment.isAdded()) { + lastInFragments.put(containerId, fragment); + } + if (firstOutFragments.get(containerId) == fragment) { + firstOutFragments.remove(containerId); + } } } } @@ -835,7 +847,7 @@ final class BackStackRecord extends FragmentTransaction implements while (op != null) { switch (op.cmd) { case OP_ADD: - setLastIn(lastInFragments, op.fragment); + setLastIn(firstOutFragments, lastInFragments, op.fragment); break; case OP_REPLACE: { Fragment f = op.fragment; @@ -845,29 +857,30 @@ final class BackStackRecord extends FragmentTransaction implements if (f == null || old.mContainerId == f.mContainerId) { if (old == f) { f = null; + lastInFragments.remove(old.mContainerId); } else { - setFirstOut(firstOutFragments, old); + setFirstOut(firstOutFragments, lastInFragments, old); } } } } - setLastIn(lastInFragments, f); + setLastIn(firstOutFragments, lastInFragments, op.fragment); break; } case OP_REMOVE: - setFirstOut(firstOutFragments, op.fragment); + setFirstOut(firstOutFragments, lastInFragments, op.fragment); break; case OP_HIDE: - setFirstOut(firstOutFragments, op.fragment); + setFirstOut(firstOutFragments, lastInFragments, op.fragment); break; case OP_SHOW: - setLastIn(lastInFragments, op.fragment); + setLastIn(firstOutFragments, lastInFragments, op.fragment); break; case OP_DETACH: - setFirstOut(firstOutFragments, op.fragment); + setFirstOut(firstOutFragments, lastInFragments, op.fragment); break; case OP_ATTACH: - setLastIn(lastInFragments, op.fragment); + setLastIn(firstOutFragments, lastInFragments, op.fragment); break; } @@ -889,38 +902,38 @@ final class BackStackRecord extends FragmentTransaction implements if (!mManager.mContainer.onHasView()) { return; // nothing to see, so no transitions } - Op op = mHead; + Op op = mTail; while (op != null) { switch (op.cmd) { case OP_ADD: - setFirstOut(firstOutFragments, op.fragment); + setFirstOut(firstOutFragments, lastInFragments, op.fragment); break; case OP_REPLACE: if (op.removed != null) { for (int i = op.removed.size() - 1; i >= 0; i--) { - setLastIn(lastInFragments, op.removed.get(i)); + setLastIn(firstOutFragments, lastInFragments, op.removed.get(i)); } } - setFirstOut(firstOutFragments, op.fragment); + setFirstOut(firstOutFragments, lastInFragments, op.fragment); break; case OP_REMOVE: - setLastIn(lastInFragments, op.fragment); + setLastIn(firstOutFragments, lastInFragments, op.fragment); break; case OP_HIDE: - setLastIn(lastInFragments, op.fragment); + setLastIn(firstOutFragments, lastInFragments, op.fragment); break; case OP_SHOW: - setFirstOut(firstOutFragments, op.fragment); + setFirstOut(firstOutFragments, lastInFragments, op.fragment); break; case OP_DETACH: - setLastIn(lastInFragments, op.fragment); + setLastIn(firstOutFragments, lastInFragments, op.fragment); break; case OP_ATTACH: - setFirstOut(firstOutFragments, op.fragment); + setFirstOut(firstOutFragments, lastInFragments, op.fragment); break; } - op = op.next; + op = op.prev; } } @@ -957,6 +970,7 @@ final class BackStackRecord extends FragmentTransaction implements */ private TransitionState beginTransition(SparseArray<Fragment> firstOutFragments, SparseArray<Fragment> lastInFragments, boolean isBack) { + ensureFragmentsAreInitialized(lastInFragments); TransitionState state = new TransitionState(); // Adding a non-existent target view makes sure that the transitions don't target @@ -982,6 +996,21 @@ final class BackStackRecord extends FragmentTransaction implements return state; } + /** + * Ensure that fragments that are entering are at least at the CREATED state + * so that they may load Transitions using TransitionInflater. + */ + private void ensureFragmentsAreInitialized(SparseArray<Fragment> lastInFragments) { + final int count = lastInFragments.size(); + for (int i = 0; i < count; i++) { + final Fragment fragment = lastInFragments.valueAt(i); + if (fragment.mState < Fragment.CREATED) { + mManager.makeActive(fragment); + mManager.moveToState(fragment, Fragment.CREATED, 0, 0, false); + } + } + } + private static Transition cloneTransition(Transition transition) { if (transition != null) { transition = transition.clone(); diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index c504ce3b1a06..136b810d5ee7 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -52,6 +52,8 @@ interface INotificationManager int getTopicVisibilityOverride(String pkg, int uid, in Notification.Topic topic); void setTopicPriority(String pkg, int uid, in Notification.Topic topic, int priority); int getTopicPriority(String pkg, int uid, in Notification.Topic topic); + void setTopicImportance(String pkg, int uid, in Notification.Topic topic, int importance); + int getTopicImportance(String pkg, int uid, in Notification.Topic topic); // TODO: Remove this when callers have been migrated to the equivalent // INotificationListener method. diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 2d825fa62791..3e8a51e47c9d 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -74,6 +74,8 @@ import java.util.UUID; * {@link #listenUsingRfcommWithServiceRecord(String,UUID)}; or start a scan for * Bluetooth LE devices with {@link #startLeScan(LeScanCallback callback)}. * + * <p>This class is thread safe. + * * <p class="note"><strong>Note:</strong> * Most methods require the {@link android.Manifest.permission#BLUETOOTH} * permission and some also require the @@ -82,7 +84,7 @@ import java.util.UUID; * <div class="special reference"> * <h3>Developer Guides</h3> * <p>For more information about using Bluetooth, read the - * <a href="{@docRoot}guide/topics/wireless/bluetooth.html">Bluetooth</a> developer guide.</p> + * <a href="{@docRoot}guide/topics/wireless/bluetooth.html">Bluetooth</a> developer guide. * </div> * * {@see BluetoothDevice} diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index aa960a400ebb..abd4c28d9f1c 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -259,6 +259,14 @@ public abstract class PackageManager { */ public static final int SKIP_CURRENT_PROFILE = 0x00000002; + /** + * Flag for {@link addCrossProfileIntentFilter}: if this flag is set: + * activities in the other profiles can respond to the intent only if no activity with + * non-negative priority in current profile can respond to the intent. + * @hide + */ + public static final int ONLY_IF_NO_MATCH_FOUND = 0x00000004; + /** @hide */ @IntDef({PERMISSION_GRANTED, PERMISSION_DENIED}) @Retention(RetentionPolicy.SOURCE) @@ -4636,7 +4644,8 @@ public abstract class PackageManager { * @param filter The {@link IntentFilter} the intent has to match * @param sourceUserId The source user id. * @param targetUserId The target user id. - * @param flags The only possible value is {@link SKIP_CURRENT_PROFILE} + * @param flags The possible values are {@link SKIP_CURRENT_PROFILE} and + * {@link ONLY_IF_NO_MATCH_FOUND}. * @hide */ public abstract void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java index b3f03c329061..a413f36cc91f 100644 --- a/core/java/android/content/pm/RegisteredServicesCache.java +++ b/core/java/android/content/pm/RegisteredServicesCache.java @@ -294,14 +294,16 @@ public abstract class RegisteredServicesCache<V> { */ public static class ServiceInfo<V> { public final V type; + public final ComponentInfo componentInfo; public final ComponentName componentName; public final int uid; /** @hide */ - public ServiceInfo(V type, ComponentName componentName, int uid) { + public ServiceInfo(V type, ComponentInfo componentInfo, ComponentName componentName) { this.type = type; + this.componentInfo = componentInfo; this.componentName = componentName; - this.uid = uid; + this.uid = (componentInfo != null) ? componentInfo.applicationInfo.uid : -1; } @Override @@ -362,8 +364,9 @@ public abstract class RegisteredServicesCache<V> { @VisibleForTesting protected List<ResolveInfo> queryIntentServices(int userId) { final PackageManager pm = mContext.getPackageManager(); - return pm.queryIntentServicesAsUser( - new Intent(mInterfaceName), PackageManager.GET_META_DATA, userId); + return pm.queryIntentServicesAsUser(new Intent(mInterfaceName), + PackageManager.GET_META_DATA | PackageManager.GET_ENCRYPTION_UNAWARE_COMPONENTS, + userId); } /** @@ -563,9 +566,7 @@ public abstract class RegisteredServicesCache<V> { return null; } final android.content.pm.ServiceInfo serviceInfo = service.serviceInfo; - final ApplicationInfo applicationInfo = serviceInfo.applicationInfo; - final int uid = applicationInfo.uid; - return new ServiceInfo<V>(v, componentName, uid); + return new ServiceInfo<V>(v, serviceInfo, componentName); } catch (NameNotFoundException e) { throw new XmlPullParserException( "Unable to load resources for pacakge " + si.packageName); diff --git a/core/java/android/net/LocalSocket.java b/core/java/android/net/LocalSocket.java index a374a869d13b..e14facb1abb5 100644 --- a/core/java/android/net/LocalSocket.java +++ b/core/java/android/net/LocalSocket.java @@ -25,7 +25,8 @@ import java.net.SocketOptions; /** * Creates a (non-server) socket in the UNIX-domain namespace. The interface - * here is not entirely unlike that of java.net.Socket + * here is not entirely unlike that of java.net.Socket. This class and the streams + * returned from it may be used from multiple threads. */ public class LocalSocket implements Closeable { diff --git a/core/java/android/net/http/HttpResponseCache.java b/core/java/android/net/http/HttpResponseCache.java index 188287f5b5db..729aff0ce278 100644 --- a/core/java/android/net/http/HttpResponseCache.java +++ b/core/java/android/net/http/HttpResponseCache.java @@ -36,7 +36,8 @@ import java.util.Map; * saving time and bandwidth. This class supports {@link * java.net.HttpURLConnection} and {@link javax.net.ssl.HttpsURLConnection}; * there is no platform-provided cache for {@code DefaultHttpClient} or - * {@code AndroidHttpClient}. + * {@code AndroidHttpClient}. Installation and instances are thread + * safe. * * <h3>Installing an HTTP response cache</h3> * Enable caching of all of your application's HTTP requests by installing the diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 79390d4696d7..c2fc5e4f64c2 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -755,6 +755,23 @@ public class UserManager { } /** + * Return whether the given user is running in a "locked" state. A user + * is unlocked only after they've entered their credentials (such as a lock + * pattern or PIN), and credential-encrypted private app data storage is + * available. + * + * @param user to retrieve the unlocked state for. + */ + public boolean isUserRunningAndLocked(UserHandle user) { + try { + return ActivityManagerNative.getDefault().isUserRunning( + user.getIdentifier(), ActivityManager.FLAG_AND_LOCKED); + } catch (RemoteException e) { + return false; + } + } + + /** * Return whether the given user is running in an "unlocked" state. A user * is unlocked only after they've entered their credentials (such as a lock * pattern or PIN), and credential-encrypted private app data storage is @@ -762,7 +779,7 @@ public class UserManager { * * @param user to retrieve the unlocked state for. */ - public boolean isUserRunningUnlocked(UserHandle user) { + public boolean isUserRunningAndUnlocked(UserHandle user) { try { return ActivityManagerNative.getDefault().isUserRunning( user.getIdentifier(), ActivityManager.FLAG_AND_UNLOCKED); diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 94a2bea086a7..c0d95a10a271 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -394,12 +394,19 @@ public final class ContactsContract { Uri.withAppendedPath(AUTHORITY_URI, "directories"); /** - * The content:// style URI for enterprise Directory table. Requests to this URI can be - * performed on the UI thread because they are always unblocking. + * URI used for getting all directories from primary and managed profile. + * It supports the same semantics as {@link #CONTENT_URI} and returns the same columns. + * If the device has no managed profile that is linked to the current profile, it behaves + * in the exact same way as {@link #CONTENT_URI}. + * If there is a managed profile linked to the current profile, it will merge + * managed profile and current profile's results and return. + * + * Note: this query returns primary profile results before managed profile results, + * and this order is not affected by sorting parameter. * */ - public static final Uri CORP_CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, - "directories_corp"); + public static final Uri ENTERPRISE_CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, + "directories_enterprise"); /** * The MIME-type of {@link #CONTENT_URI} providing a directory of @@ -426,16 +433,12 @@ public final class ContactsContract { /** * _ID of the work profile default directory, which represents locally stored contacts. - * - * @hide */ public static final long ENTERPRISE_DEFAULT = Directory.ENTERPRISE_DIRECTORY_ID_BASE + DEFAULT; /** * _ID of the work profile directory that represents locally stored invisible contacts. - * - * @hide */ public static final long ENTERPRISE_LOCAL_INVISIBLE = Directory.ENTERPRISE_DIRECTORY_ID_BASE + LOCAL_INVISIBLE; @@ -1640,12 +1643,12 @@ public final class ContactsContract { CONTENT_URI, "filter"); /** - * It supports the same semantics as {@link #CONTENT_FILTER_URI} and returns the same - * columns. If there is a corp profile linked to the current profile, it will query corp - * profile, otherwise it will return null. + * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the same + * columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in parameters, + * otherwise it will throw UnsupportedOperationException. */ - public static final Uri CORP_CONTENT_FILTER_URI = Uri.withAppendedPath( - CORP_CONTENT_URI, "filter"); + public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath( + CONTENT_URI, "filter_enterprise"); /** * The content:// style URI for this table joined with useful data from @@ -5915,6 +5918,14 @@ public final class ContactsContract { "filter"); /** + * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the same + * columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in + * parameters, otherwise it will throw UnsupportedOperationException. + */ + public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath( + CONTENT_URI, "filter_enterprise"); + + /** * A boolean query parameter that can be used with {@link #CONTENT_FILTER_URI}. * If "1" or "true", display names are searched. If "0" or "false", display names * are not searched. Default is "1". @@ -7395,6 +7406,14 @@ public final class ContactsContract { */ public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI, "filter"); + + /** + * Similar to {@link Phone#ENTERPRISE_CONTENT_FILTER_URI}, but allows users to filter + * callable data. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in + * parameters, otherwise it will throw UnsupportedOperationException. + */ + public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath( + CONTENT_URI, "filter_enterprise"); } /** diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java index d53bb0d2aa18..77a44859ee5a 100644 --- a/core/java/android/provider/DocumentsContract.java +++ b/core/java/android/provider/DocumentsContract.java @@ -234,6 +234,7 @@ public final class DocumentsContract { * @see #FLAG_DIR_PREFERS_GRID * @see #FLAG_DIR_PREFERS_LAST_MODIFIED * @see #FLAG_VIRTUAL_DOCUMENT + * @see #FLAG_ARCHIVE */ public static final String COLUMN_FLAGS = "flags"; @@ -368,6 +369,18 @@ public final class DocumentsContract { public static final int FLAG_VIRTUAL_DOCUMENT = 1 << 10; /** + * Flag indicating that a document is an archive, and it's contents can be + * obtained via {@link DocumentsProvider#queryChildDocuments}. + * <p> + * The <em>provider</em> support library offers utility classes to add common + * archive support. + * + * @see #COLUMN_FLAGS + * @see DocumentsProvider#queryChildDocuments(String, String[], String) + */ + public static final int FLAG_ARCHIVE = 1 << 11; + + /** * Flag indicating that document titles should be hidden when viewing * this directory in a larger format grid. For example, a directory * containing only images may want the image thumbnails to speak for diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index c92382a7d661..fa1bf76f565e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -4931,6 +4931,15 @@ public final class Settings { "accessibility_autoclick_delay"; /** + * Whether or not larger size icons are used for the pointer of mouse/trackpad for + * accessibility. + * (0 = false, 1 = true) + * @hide + */ + public static final String ACCESSIBILITY_LARGE_POINTER_ICON = + "accessibility_large_pointer_icon"; + + /** * The timeout for considering a press to be a long press in milliseconds. * @hide */ diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index d741f1a142ca..a7545f21ad22 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -823,9 +823,9 @@ public abstract class NotificationListenerService extends Service { public static final int VISIBILITY_NO_OVERRIDE = -1000; /** - * Value signifying thatn the has not expressed an importance. + * Value signifying that the user has not expressed an importance. * - * This value is for persisting preferences, and should never ve associated with + * This value is for persisting preferences, and should never be associated with * an actual notification. */ public static final int IMPORTANCE_UNSPECIFIED = -1000; @@ -952,6 +952,28 @@ public abstract class NotificationListenerService extends Service { mVisibilityOverride = visibilityOverride; mSuppressedVisualEffects = suppressedVisualEffects; } + + /** + * {@hide} + */ + public static String importanceToString(int importance) { + switch (importance) { + case IMPORTANCE_UNSPECIFIED: + return "UNSPECIFIED"; + case IMPORTANCE_NONE: + return "NONE"; + case IMPORTANCE_LOW: + return "LOW"; + case IMPORTANCE_DEFAULT: + return "DEFAULT"; + case IMPORTANCE_HIGH: + return "HIGH"; + case IMPORTANCE_MAX: + return "MAX"; + default: + return "UNKNOWN(" + String.valueOf(importance) + ")"; + } + } } /** diff --git a/core/java/android/util/EventLog.java b/core/java/android/util/EventLog.java index 558b8f558236..6bda83d2b315 100644 --- a/core/java/android/util/EventLog.java +++ b/core/java/android/util/EventLog.java @@ -52,7 +52,7 @@ public class EventLog { private static HashMap<String, Integer> sTagCodes = null; private static HashMap<Integer, String> sTagNames = null; - /** A previously logged event read from the logs. */ + /** A previously logged event read from the logs. Instances are thread safe. */ public static final class Event { private final ByteBuffer mBuffer; diff --git a/core/java/android/util/LocaleList.aidl b/core/java/android/util/LocaleList.aidl new file mode 100644 index 000000000000..f5de35415999 --- /dev/null +++ b/core/java/android/util/LocaleList.aidl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.util; + +parcelable LocaleList; diff --git a/core/java/android/util/LocaleList.java b/core/java/android/util/LocaleList.java index c1d23bb9d7e7..b2ee045db451 100644 --- a/core/java/android/util/LocaleList.java +++ b/core/java/android/util/LocaleList.java @@ -19,6 +19,8 @@ package android.util; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Size; +import android.os.Parcel; +import android.os.Parcelable; import com.android.internal.annotations.GuardedBy; @@ -35,11 +37,12 @@ import java.util.Locale; * LocaleList is an immutable list of Locales, typically used to keep an * ordered user preferences for locales. */ -public final class LocaleList { +public final class LocaleList implements Parcelable { private final Locale[] mList; // This is a comma-separated list of the locales in the LocaleList created at construction time, // basically the result of running each locale's toLanguageTag() method and concatenating them // with commas in between. + @NonNull private final String mStringRepresentation; private static final Locale[] sEmptyList = new Locale[0]; @@ -101,6 +104,16 @@ public final class LocaleList { return sb.toString(); } + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int parcelableFlags) { + dest.writeString(mStringRepresentation); + } + @NonNull public String toLanguageTags() { return mStringRepresentation; @@ -163,10 +176,25 @@ public final class LocaleList { } } + public static final Parcelable.Creator<LocaleList> CREATOR + = new Parcelable.Creator<LocaleList>() { + @Override + public LocaleList createFromParcel(Parcel source) { + return LocaleList.forLanguageTags(source.readString()); + } + + @Override + public LocaleList[] newArray(int size) { + return new LocaleList[size]; + } + }; + + @NonNull public static LocaleList getEmptyLocaleList() { return sEmptyLocaleList; } + @NonNull public static LocaleList forLanguageTags(@Nullable String list) { if (list == null || list.equals("")) { return getEmptyLocaleList(); diff --git a/core/java/android/view/PointerIcon.java b/core/java/android/view/PointerIcon.java index b61706ef4424..d2a7d4ad4859 100644 --- a/core/java/android/view/PointerIcon.java +++ b/core/java/android/view/PointerIcon.java @@ -16,6 +16,8 @@ package android.view; +import android.os.UserHandle; +import android.provider.Settings; import com.android.internal.util.XmlUtils; import android.annotation.XmlRes; @@ -199,9 +201,14 @@ public final class PointerIcon implements Parcelable { styleIndex = getSystemIconStyleIndex(STYLE_DEFAULT); } + int accessibilityConfig = Settings.Secure.getIntForUser( + context.getContentResolver(), Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON, + 0, UserHandle.USER_CURRENT); + int defStyle = (accessibilityConfig == 1) ? + com.android.internal.R.style.LargePointer : com.android.internal.R.style.Pointer; TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.Pointer, - com.android.internal.R.attr.pointerStyle, 0); + 0, defStyle); int resourceId = a.getResourceId(styleIndex, -1); a.recycle(); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index b0e68deb03d0..49b21f93f803 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -3057,14 +3057,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * @hide * - * Makes system ui transparent. + * Makes navigation bar transparent (but not the status bar). */ - public static final int SYSTEM_UI_TRANSPARENT = 0x00008000; + public static final int NAVIGATION_BAR_TRANSPARENT = 0x00008000; /** * @hide + * + * Makes status bar transparent (but not the navigation bar). */ - public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = 0x00003FFF; + public static final int STATUS_BAR_TRANSPARENT = 0x0000008; + + /** + * @hide + * + * Makes both status bar and navigation bar transparent. + */ + public static final int SYSTEM_UI_TRANSPARENT = NAVIGATION_BAR_TRANSPARENT + | STATUS_BAR_TRANSPARENT; + + /** + * @hide + */ + public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = 0x00003FF7; /** * These are the system UI flags that can be cleared by events outside @@ -18559,13 +18574,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @param location an array of two integers in which to hold the coordinates */ - public void getLocationOnScreen(@Size(2) int[] location) { - getLocationInWindow(location); + public void getLocationOnScreen(@Size(2) int[] outLocation) { + getLocationInWindow(outLocation); final AttachInfo info = mAttachInfo; if (info != null) { - location[0] += info.mWindowLeft; - location[1] += info.mWindowTop; + outLocation[0] += info.mWindowLeft; + outLocation[1] += info.mWindowTop; } } @@ -18576,11 +18591,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @param outWindowSpace an array of two integers in which to hold the coordinates */ - public void getLocationInWindow(@Size(2) int[] outWindowSpace) { - outWindowSpace[0] = 0; - outWindowSpace[1] = 0; + public void getLocationInWindow(@Size(2) int[] outLocation) { + if (outLocation == null || outLocation.length < 2) { + throw new IllegalArgumentException("outLocation must be an array of two integers"); + } + + outLocation[0] = 0; + outLocation[1] = 0; - transformFromViewToWindowSpace(outWindowSpace); + transformFromViewToWindowSpace(outLocation); } void transformFromViewToWindowSpace(@Size(2) int[] inOutLocation) { diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java index 6130fd58ac9a..3ff95228f15e 100644 --- a/core/java/android/view/inputmethod/EditorInfo.java +++ b/core/java/android/view/inputmethod/EditorInfo.java @@ -21,6 +21,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.text.InputType; import android.text.TextUtils; +import android.util.LocaleList; import android.util.Printer; /** @@ -340,6 +341,22 @@ public class EditorInfo implements InputType, Parcelable { public Bundle extras; /** + * Additional context information that tells what languages are expected by the user. + * + * <p><strong>IME authors:</strong> Possible use cases for IME developers would be:</p> + * <ul> + * <li>Automatically switching keyboard layout.</li> + * <li>Changing language model for better typing experience.</li> + * </ul> + * + * <p><strong>Editor authors:</strong> Providing this context information can help IMEs to + * improve text input experience. For example, chat applications can remember what language is + * used in the last conversation for each chat session, and put the last used language at the + * top of {@link #locales}.</p> + */ + public LocaleList locales = LocaleList.getEmptyLocaleList(); + + /** * Ensure that the data in this EditorInfo is compatible with an application * that was developed against the given target API version. This can * impact the following input types: @@ -393,6 +410,7 @@ public class EditorInfo implements InputType, Parcelable { + " fieldId=" + fieldId + " fieldName=" + fieldName); pw.println(prefix + "extras=" + extras); + pw.println(prefix + "locales=" + locales); } /** @@ -416,6 +434,7 @@ public class EditorInfo implements InputType, Parcelable { dest.writeInt(fieldId); dest.writeString(fieldName); dest.writeBundle(extras); + locales.writeToParcel(dest, flags); } /** @@ -439,6 +458,7 @@ public class EditorInfo implements InputType, Parcelable { res.fieldId = source.readInt(); res.fieldName = source.readString(); res.extras = source.readBundle(); + res.locales = LocaleList.CREATOR.createFromParcel(source); return res; } diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index 88f02d1fcd5f..45fc6c3d4c7a 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -45,7 +45,9 @@ import android.text.TextUtils; import android.text.TextWatcher; import android.text.style.ImageSpan; import android.util.AttributeSet; +import android.util.DisplayMetrics; import android.util.Log; +import android.util.TypedValue; import android.view.CollapsibleActionView; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -1722,6 +1724,14 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { mThreshold = getThreshold(); } + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + DisplayMetrics metrics = getResources().getDisplayMetrics(); + setMinWidth((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + getSearchViewTextMinWidthDp(), metrics)); + } + void setSearchView(SearchView searchView) { mSearchView = searchView; } @@ -1818,5 +1828,21 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { return super.onKeyPreIme(keyCode, event); } + /** + * Get minimum width of the search view text entry area. + */ + private int getSearchViewTextMinWidthDp() { + final Configuration configuration = getResources().getConfiguration(); + final int width = configuration.screenWidthDp; + final int height = configuration.screenHeightDp; + final int orientation = configuration.orientation; + if (width >= 960 && height >= 720 + && orientation == Configuration.ORIENTATION_LANDSCAPE) { + return 256; + } else if (width >= 600 || (width >= 640 && height >= 480)) { + return 192; + }; + return 160; + } } } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index d666939ba5a0..cca84ee707d5 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -6439,6 +6439,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener outAttrs.initialCapsMode = ic.getCursorCapsMode(getInputType()); return ic; } + // LocaleList is designed to be immutable. This is theoretically equivalent to copy + // the snapshot of the current text locales. + outAttrs.locales = getTextLocales(); } return null; } diff --git a/core/java/com/android/internal/policy/BackdropFrameRenderer.java b/core/java/com/android/internal/policy/BackdropFrameRenderer.java index b101733a1a14..75ca639a2317 100644 --- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java +++ b/core/java/com/android/internal/policy/BackdropFrameRenderer.java @@ -17,6 +17,7 @@ package com.android.internal.policy; import android.graphics.Rect; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Looper; import android.view.Choreographer; @@ -44,6 +45,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame // The render nodes for the multi threaded renderer. private ThreadedRenderer mRenderer; private RenderNode mFrameAndBackdropNode; + private RenderNode mSystemBarBackgroundNode; private final Rect mOldTargetRect = new Rect(); private final Rect mNewTargetRect = new Rect(); @@ -62,13 +64,16 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame private Drawable mCaptionBackgroundDrawable; private Drawable mResizingBackgroundDrawable; + private ColorDrawable mStatusBarColor; public BackdropFrameRenderer(DecorView decorView, ThreadedRenderer renderer, Rect initialBounds, - Drawable resizingBackgroundDrawable, Drawable captionBackgroundDrawable) { + Drawable resizingBackgroundDrawable, Drawable captionBackgroundDrawable, + int statusBarColor) { setName("ResizeFrame"); mRenderer = renderer; - onResourcesLoaded(decorView, resizingBackgroundDrawable, captionBackgroundDrawable); + onResourcesLoaded(decorView, resizingBackgroundDrawable, captionBackgroundDrawable, + statusBarColor); // Create a render node for the content and frame backdrop // which can be resized independently from the content. @@ -87,10 +92,24 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame } void onResourcesLoaded(DecorView decorView, Drawable resizingBackgroundDrawable, - Drawable captionBackgroundDrawableDrawable) { + Drawable captionBackgroundDrawableDrawable, int statusBarColor) { mDecorView = decorView; mResizingBackgroundDrawable = resizingBackgroundDrawable; mCaptionBackgroundDrawable = captionBackgroundDrawableDrawable; + if (statusBarColor != 0) { + mStatusBarColor = new ColorDrawable(statusBarColor); + addSystemBarNodeIfNeeded(); + } else { + mStatusBarColor = null; + } + } + + private void addSystemBarNodeIfNeeded() { + if (mSystemBarBackgroundNode != null) { + return; + } + mSystemBarBackgroundNode = RenderNode.create("SystemBarBackgroundNode", null); + mRenderer.addRenderNode(mSystemBarBackgroundNode, false); } /** @@ -132,6 +151,9 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame // Remove the render node again // (see comment above - better to do that only once). mRenderer.removeRenderNode(mFrameAndBackdropNode); + if (mSystemBarBackgroundNode != null) { + mRenderer.removeRenderNode(mSystemBarBackgroundNode); + } mRenderer = null; @@ -232,6 +254,8 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame // inaccessible. For that case we remember the previous metrics to avoid flashes. // Note that even when there is no visible caption, the caption child will exist. final int captionHeight = mDecorView.getCaptionHeight(); + final int statusBarHeight = mDecorView.getStatusBarHeight(); + // The caption height will probably never dynamically change while we are resizing. // Once set to something other then 0 it should be kept that way. if (captionHeight != 0) { @@ -256,7 +280,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame mFrameAndBackdropNode.setLeftTopRightBottom(left, top, left + width, top + height); // Draw the caption and content backdrops in to our render node. - final DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height); + DisplayListCanvas canvas = mFrameAndBackdropNode.start(width, height); mCaptionBackgroundDrawable.setBounds(0, 0, left + width, top + mLastCaptionHeight); mCaptionBackgroundDrawable.draw(canvas); @@ -265,6 +289,15 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame mResizingBackgroundDrawable.draw(canvas); mFrameAndBackdropNode.end(canvas); + if (mSystemBarBackgroundNode != null && mStatusBarColor != null) { + canvas = mSystemBarBackgroundNode.start(width, height); + mSystemBarBackgroundNode.setLeftTopRightBottom(left, top, left + width, top + height); + mStatusBarColor.setBounds(0, 0, left + width, statusBarHeight); + mStatusBarColor.draw(canvas); + mSystemBarBackgroundNode.end(canvas); + mRenderer.drawRenderNode(mSystemBarBackgroundNode); + } + // We need to render the node explicitly mRenderer.drawRenderNode(mFrameAndBackdropNode); diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index a95c4012478b..9107b1f2f6a1 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -151,6 +151,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private final Interpolator mShowInterpolator; private final Interpolator mHideInterpolator; private final int mBarEnterExitDuration; + private final boolean mForceWindowDrawsStatusBarBackground; + private final int mSemiTransparentStatusBarColor; private final BackgroundFallback mBackgroundFallback = new BackgroundFallback(); @@ -197,6 +199,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mBarEnterExitDuration = context.getResources().getInteger( R.integer.dock_enter_exit_duration); + mForceWindowDrawsStatusBarBackground = context.getResources().getBoolean( + R.bool.config_forceWindowDrawsStatusBarBackground); + mSemiTransparentStatusBarColor = context.getResources().getColor( + R.color.system_bar_background_semi_transparent, null /* theme */); setWindow(window); } @@ -884,14 +890,15 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind int navBarSize = navBarToRightEdge ? mLastRightInset : mLastBottomInset; updateColorViewInt(mNavigationColorViewState, sysUiVisibility, mWindow.mNavigationBarColor, navBarSize, navBarToRightEdge, - 0 /* rightInset */, animate && !disallowAnimate); + 0 /* rightInset */, animate && !disallowAnimate, false /* force */); boolean statusBarNeedsRightInset = navBarToRightEdge && mNavigationColorViewState.present; int statusBarRightInset = statusBarNeedsRightInset ? mLastRightInset : 0; - updateColorViewInt(mStatusColorViewState, sysUiVisibility, mWindow.mStatusBarColor, - mLastTopInset, false /* matchVertical */, statusBarRightInset, - animate && !disallowAnimate); + updateColorViewInt(mStatusColorViewState, sysUiVisibility, + calculateStatusBarColor(), mLastTopInset, + false /* matchVertical */, statusBarRightInset, animate && !disallowAnimate, + mForceWindowDrawsStatusBarBackground); } // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need @@ -935,6 +942,21 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind return insets; } + private int calculateStatusBarColor() { + int flags = mWindow.getAttributes().flags; + return (flags & FLAG_TRANSLUCENT_STATUS) != 0 ? mSemiTransparentStatusBarColor + : (flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 ? mWindow.mStatusBarColor + : Color.BLACK; + } + + private int getCurrentColor(ColorViewState state) { + if (state.visible) { + return state.color; + } else { + return 0; + } + } + /** * Update a color view * @@ -948,13 +970,15 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind * @param animate if true, the change will be animated. */ private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color, - int size, boolean verticalBar, int rightMargin, boolean animate) { + int size, boolean verticalBar, int rightMargin, boolean animate, boolean force) { state.present = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0 && (mWindow.getAttributes().flags & state.hideWindowFlag) == 0 - && (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0; + && ((mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 + || force); boolean show = state.present && (color & Color.BLACK) != 0 - && (mWindow.getAttributes().flags & state.translucentFlag) == 0; + && ((mWindow.getAttributes().flags & state.translucentFlag) == 0 || force); + boolean showView = show && !isResizing(); boolean visibilityChanged = false; View view = state.view; @@ -964,7 +988,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind int resolvedGravity = verticalBar ? state.horizontalGravity : state.verticalGravity; if (view == null) { - if (show) { + if (showView) { state.view = view = new View(mContext); view.setBackgroundColor(color); view.setTransitionName(state.transitionName); @@ -980,7 +1004,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind updateColorViewTranslations(); } } else { - int vis = show ? VISIBLE : INVISIBLE; + int vis = showView ? VISIBLE : INVISIBLE; visibilityChanged = state.targetVisibility != vis; state.targetVisibility = vis; LayoutParams lp = (LayoutParams) view.getLayoutParams(); @@ -992,14 +1016,14 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind lp.rightMargin = rightMargin; view.setLayoutParams(lp); } - if (show) { + if (showView) { view.setBackgroundColor(color); } } if (visibilityChanged) { view.animate().cancel(); - if (animate) { - if (show) { + if (animate && !isResizing()) { + if (showView) { if (view.getVisibility() != VISIBLE) { view.setVisibility(VISIBLE); view.setAlpha(0.0f); @@ -1019,9 +1043,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } else { view.setAlpha(1.0f); - view.setVisibility(show ? VISIBLE : INVISIBLE); + view.setVisibility(showView ? VISIBLE : INVISIBLE); } } + state.visible = show; + state.color = color; } private void updateColorViewTranslations() { @@ -1553,7 +1579,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (mBackdropFrameRenderer != null) { mBackdropFrameRenderer.onResourcesLoaded( - this, mResizingBackgroundDrawable, mCaptionBackgroundDrawable); + this, mResizingBackgroundDrawable, mCaptionBackgroundDrawable, + getCurrentColor(mStatusColorViewState)); } mDecorCaptionView = createDecorCaptionView(inflater); @@ -1668,9 +1695,15 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (mDecorCaptionView != null) { mDecorCaptionView.removeContentView(); } else { - // This window doesn't have caption, so we need to just remove the - // children of the decor view. - removeAllViews(); + // This window doesn't have caption, so we need to remove everything except our views + // we might have added. + for (int i = getChildCount() - 1; i >= 0; i--) { + View v = getChildAt(i); + if (v != mStatusColorViewState.view && v != mNavigationColorViewState.view + && v != mStatusGuard && v != mNavigationGuard) { + removeViewAt(i); + } + } } } @@ -1694,18 +1727,22 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind final ThreadedRenderer renderer = (ThreadedRenderer) getHardwareRenderer(); if (renderer != null) { mBackdropFrameRenderer = new BackdropFrameRenderer(this, renderer, - initialBounds, mResizingBackgroundDrawable, mCaptionBackgroundDrawable); + initialBounds, mResizingBackgroundDrawable, mCaptionBackgroundDrawable, + getCurrentColor(mStatusColorViewState)); // Get rid of the shadow while we are resizing. Shadow drawing takes considerable time. // If we want to get the shadow shown while resizing, we would need to elevate a new // element which owns the caption and has the elevation. updateElevation(); + + updateColorViews(null /* insets */, false); } } @Override public void onWindowDragResizeEnd() { releaseThreadedRenderer(); + updateColorViews(null /* insets */, false); } @Override @@ -1738,6 +1775,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } + private boolean isResizing() { + return mBackdropFrameRenderer != null; + } + /** * The elevation gets set for the first time and the framework needs to be informed that * the surface layer gets created with the shadow size in mind. @@ -1753,8 +1794,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind final boolean wasAdjustedForStack = mElevationAdjustedForStack; // Do not use a shadow when we are in resizing mode (mBackdropFrameRenderer not null) // since the shadow is bound to the content size and not the target size. - if (ActivityManager.StackId.hasWindowShadow(mStackId) - && mBackdropFrameRenderer == null) { + if (ActivityManager.StackId.hasWindowShadow(mStackId) && !isResizing()) { elevation = hasWindowFocus() ? DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP; // TODO(skuhne): Remove this if clause once b/22668382 got fixed. @@ -1784,6 +1824,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind return isShowingCaption() ? mDecorCaptionView.getCaptionHeight() : 0; } + int getStatusBarHeight() { + return mStatusColorViewState.view != null ? mStatusColorViewState.view.getHeight() : 0; + } + /** * Converts a DIP measure into physical pixels. * @param dip The dip value. @@ -1798,6 +1842,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind View view = null; int targetVisibility = View.INVISIBLE; boolean present = false; + boolean visible; + int color; final int id; final int systemUiHideFlag; diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 04f1dc599b1a..57d2244944ab 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -2406,6 +2406,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { setNeedsMenuKey(WindowManager.LayoutParams.NEEDS_MENU_SET_FALSE); } + if (!mForcedStatusBarColor) { + mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, 0xFF000000); + } + if (!mForcedNavigationBarColor) { + mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000); + } + // Non-floating windows on high end devices must put up decor beneath the system bars and // therefore must know about visibility changes of those. if (!mIsFloating && ActivityManager.isHighEndGfx()) { @@ -2416,12 +2423,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS & ~getForcedWindowFlags()); } } - if (!mForcedStatusBarColor) { - mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, 0xFF000000); - } - if (!mForcedNavigationBarColor) { - mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000); - } if (a.getBoolean(R.styleable.Window_windowLightStatusBar, false)) { decor.setSystemUiVisibility( decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); diff --git a/core/java/com/android/internal/view/ActionBarPolicy.java b/core/java/com/android/internal/view/ActionBarPolicy.java index 007ab29a0f41..755faf333a1e 100644 --- a/core/java/com/android/internal/view/ActionBarPolicy.java +++ b/core/java/com/android/internal/view/ActionBarPolicy.java @@ -78,7 +78,11 @@ public class ActionBarPolicy { // The embedded tabs policy changed in Jellybean; give older apps the old policy // so they get what they expect. - return mContext.getResources().getBoolean(R.bool.action_bar_embed_tabs_pre_jb); + final Configuration configuration = mContext.getResources().getConfiguration(); + final int width = configuration.screenWidthDp; + final int height = configuration.screenHeightDp; + return configuration.orientation == Configuration.ORIENTATION_LANDSCAPE || + width >= 480 || (width >= 640 && height >= 480); } public int getTabContainerHeight() { diff --git a/core/java/com/android/internal/view/menu/ActionMenuItemView.java b/core/java/com/android/internal/view/menu/ActionMenuItemView.java index ce5bc908814c..bd97e5d47714 100644 --- a/core/java/com/android/internal/view/menu/ActionMenuItemView.java +++ b/core/java/com/android/internal/view/menu/ActionMenuItemView.java @@ -72,8 +72,7 @@ public class ActionMenuItemView extends TextView public ActionMenuItemView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); final Resources res = context.getResources(); - mAllowTextWithIcon = res.getBoolean( - com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon); + mAllowTextWithIcon = shouldAllowTextWithIcon(); final TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ActionMenuItemView, defStyleAttr, defStyleRes); mMinWidth = a.getDimensionPixelSize( @@ -93,11 +92,22 @@ public class ActionMenuItemView extends TextView public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - mAllowTextWithIcon = getContext().getResources().getBoolean( - com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon); + mAllowTextWithIcon = shouldAllowTextWithIcon(); updateTextButtonVisibility(); } + /** + * Whether action menu items should obey the "withText" showAsAction flag. This may be set to + * false for situations where space is extremely limited. --> + */ + private boolean shouldAllowTextWithIcon() { + final Configuration configuration = getContext().getResources().getConfiguration(); + final int width = configuration.screenWidthDp; + final int height = configuration.screenHeightDp; + return width >= 480 || (width >= 640 && height >= 480) + || configuration.orientation == Configuration.ORIENTATION_LANDSCAPE; + } + @Override public void setPadding(int l, int t, int r, int b) { mSavedPaddingLeft = l; diff --git a/core/res/res/drawable-mdpi/pointer_alias_large.png b/core/res/res/drawable-mdpi/pointer_alias_large.png Binary files differnew file mode 100644 index 000000000000..283bf7f48fec --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_alias_large.png diff --git a/core/res/res/drawable-mdpi/pointer_all_scroll_large.png b/core/res/res/drawable-mdpi/pointer_all_scroll_large.png Binary files differnew file mode 100644 index 000000000000..c29db8702736 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_all_scroll_large.png diff --git a/core/res/res/drawable-mdpi/pointer_arrow_large.png b/core/res/res/drawable-mdpi/pointer_arrow_large.png Binary files differnew file mode 100644 index 000000000000..9f59c4cae921 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_arrow_large.png diff --git a/core/res/res/drawable-mdpi/pointer_cell_large.png b/core/res/res/drawable-mdpi/pointer_cell_large.png Binary files differnew file mode 100644 index 000000000000..3dec5e5d825f --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_cell_large.png diff --git a/core/res/res/drawable-mdpi/pointer_context_menu_large.png b/core/res/res/drawable-mdpi/pointer_context_menu_large.png Binary files differnew file mode 100644 index 000000000000..7c9e250d4884 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_context_menu_large.png diff --git a/core/res/res/drawable-mdpi/pointer_copy_large.png b/core/res/res/drawable-mdpi/pointer_copy_large.png Binary files differnew file mode 100644 index 000000000000..18f4696ffc21 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_copy_large.png diff --git a/core/res/res/drawable-mdpi/pointer_crosshair_large.png b/core/res/res/drawable-mdpi/pointer_crosshair_large.png Binary files differnew file mode 100644 index 000000000000..ea1f5fc07ff7 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_crosshair_large.png diff --git a/core/res/res/drawable-mdpi/pointer_grab_large.png b/core/res/res/drawable-mdpi/pointer_grab_large.png Binary files differnew file mode 100644 index 000000000000..2e327661d68f --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_grab_large.png diff --git a/core/res/res/drawable-mdpi/pointer_grabbing_large.png b/core/res/res/drawable-mdpi/pointer_grabbing_large.png Binary files differnew file mode 100644 index 000000000000..3c547517392a --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_grabbing_large.png diff --git a/core/res/res/drawable-mdpi/pointer_hand_large.png b/core/res/res/drawable-mdpi/pointer_hand_large.png Binary files differnew file mode 100644 index 000000000000..785047f7cdfe --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_hand_large.png diff --git a/core/res/res/drawable-mdpi/pointer_help_large.png b/core/res/res/drawable-mdpi/pointer_help_large.png Binary files differnew file mode 100644 index 000000000000..6552f9bb333d --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_help_large.png diff --git a/core/res/res/drawable-mdpi/pointer_horizontal_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_horizontal_double_arrow_large.png Binary files differnew file mode 100644 index 000000000000..70861065d4ef --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_horizontal_double_arrow_large.png diff --git a/core/res/res/drawable-mdpi/pointer_nodrop_large.png b/core/res/res/drawable-mdpi/pointer_nodrop_large.png Binary files differnew file mode 100644 index 000000000000..da981df3de29 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_nodrop_large.png diff --git a/core/res/res/drawable-mdpi/pointer_text_large.png b/core/res/res/drawable-mdpi/pointer_text_large.png Binary files differnew file mode 100644 index 000000000000..2fba190552b9 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_text_large.png diff --git a/core/res/res/drawable-mdpi/pointer_top_left_diagonal_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_top_left_diagonal_double_arrow_large.png Binary files differnew file mode 100644 index 000000000000..eecaa89204ed --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_top_left_diagonal_double_arrow_large.png diff --git a/core/res/res/drawable-mdpi/pointer_top_right_diagonal_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_top_right_diagonal_double_arrow_large.png Binary files differnew file mode 100644 index 000000000000..9d47ecf793ef --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_top_right_diagonal_double_arrow_large.png diff --git a/core/res/res/drawable-mdpi/pointer_vertical_double_arrow_large.png b/core/res/res/drawable-mdpi/pointer_vertical_double_arrow_large.png Binary files differnew file mode 100644 index 000000000000..fd777b14bad1 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_vertical_double_arrow_large.png diff --git a/core/res/res/drawable-mdpi/pointer_vertical_text_large.png b/core/res/res/drawable-mdpi/pointer_vertical_text_large.png Binary files differnew file mode 100644 index 000000000000..1cbe49adb32a --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_vertical_text_large.png diff --git a/core/res/res/drawable-mdpi/pointer_zoom_in_large.png b/core/res/res/drawable-mdpi/pointer_zoom_in_large.png Binary files differnew file mode 100644 index 000000000000..923ad7922649 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_zoom_in_large.png diff --git a/core/res/res/drawable-mdpi/pointer_zoom_out_large.png b/core/res/res/drawable-mdpi/pointer_zoom_out_large.png Binary files differnew file mode 100644 index 000000000000..aa47eb94fbc6 --- /dev/null +++ b/core/res/res/drawable-mdpi/pointer_zoom_out_large.png diff --git a/core/res/res/drawable/pointer_alias_large_icon.xml b/core/res/res/drawable/pointer_alias_large_icon.xml new file mode 100644 index 000000000000..149f58cf5d01 --- /dev/null +++ b/core/res/res/drawable/pointer_alias_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_alias_large" + android:hotSpotX="19dp" + android:hotSpotY="11dp" /> diff --git a/core/res/res/drawable/pointer_all_scroll_large_icon.xml b/core/res/res/drawable/pointer_all_scroll_large_icon.xml new file mode 100644 index 000000000000..c580f765cfef --- /dev/null +++ b/core/res/res/drawable/pointer_all_scroll_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_all_scroll_large" + android:hotSpotX="32dp" + android:hotSpotY="31dp" /> diff --git a/core/res/res/drawable/pointer_arrow_large_icon.xml b/core/res/res/drawable/pointer_arrow_large_icon.xml new file mode 100644 index 000000000000..22c7bfebf951 --- /dev/null +++ b/core/res/res/drawable/pointer_arrow_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_arrow_large" + android:hotSpotX="10dp" + android:hotSpotY="10dp" /> diff --git a/core/res/res/drawable/pointer_cell_large_icon.xml b/core/res/res/drawable/pointer_cell_large_icon.xml new file mode 100644 index 000000000000..f2530b7ba1a3 --- /dev/null +++ b/core/res/res/drawable/pointer_cell_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_cell_large" + android:hotSpotX="30dp" + android:hotSpotY="30dp" /> diff --git a/core/res/res/drawable/pointer_context_menu_large_icon.xml b/core/res/res/drawable/pointer_context_menu_large_icon.xml new file mode 100644 index 000000000000..c57e615feb94 --- /dev/null +++ b/core/res/res/drawable/pointer_context_menu_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_context_menu_large" + android:hotSpotX="11dp" + android:hotSpotY="11dp" /> diff --git a/core/res/res/drawable/pointer_copy_large_icon.xml b/core/res/res/drawable/pointer_copy_large_icon.xml new file mode 100644 index 000000000000..4ee3f18f0c4b --- /dev/null +++ b/core/res/res/drawable/pointer_copy_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_copy_large" + android:hotSpotX="10dp" + android:hotSpotY="10dp" /> diff --git a/core/res/res/drawable/pointer_crosshair_large_icon.xml b/core/res/res/drawable/pointer_crosshair_large_icon.xml new file mode 100644 index 000000000000..6a71b7b638f3 --- /dev/null +++ b/core/res/res/drawable/pointer_crosshair_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_crosshair_large" + android:hotSpotX="31dp" + android:hotSpotY="30dp" /> diff --git a/core/res/res/drawable/pointer_grab_large_icon.xml b/core/res/res/drawable/pointer_grab_large_icon.xml new file mode 100644 index 000000000000..f2df1cb48381 --- /dev/null +++ b/core/res/res/drawable/pointer_grab_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_grab_large" + android:hotSpotX="21dp" + android:hotSpotY="11dp" /> diff --git a/core/res/res/drawable/pointer_grabbing_large_icon.xml b/core/res/res/drawable/pointer_grabbing_large_icon.xml new file mode 100644 index 000000000000..e4042bf66aa4 --- /dev/null +++ b/core/res/res/drawable/pointer_grabbing_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_grabbing_large" + android:hotSpotX="20dp" + android:hotSpotY="12dp" /> diff --git a/core/res/res/drawable/pointer_hand_large_icon.xml b/core/res/res/drawable/pointer_hand_large_icon.xml new file mode 100644 index 000000000000..e34422af6c13 --- /dev/null +++ b/core/res/res/drawable/pointer_hand_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_hand_large" + android:hotSpotX="25dp" + android:hotSpotY="7dp" /> diff --git a/core/res/res/drawable/pointer_help_large_icon.xml b/core/res/res/drawable/pointer_help_large_icon.xml new file mode 100644 index 000000000000..4c60a55a6458 --- /dev/null +++ b/core/res/res/drawable/pointer_help_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_help_large" + android:hotSpotX="10dp" + android:hotSpotY="11dp" /> diff --git a/core/res/res/drawable/pointer_horizontal_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_horizontal_double_arrow_large_icon.xml new file mode 100644 index 000000000000..a2039e602573 --- /dev/null +++ b/core/res/res/drawable/pointer_horizontal_double_arrow_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_horizontal_double_arrow_large" + android:hotSpotX="35dp" + android:hotSpotY="29dp" /> diff --git a/core/res/res/drawable/pointer_nodrop_large_icon.xml b/core/res/res/drawable/pointer_nodrop_large_icon.xml new file mode 100644 index 000000000000..cde2e4131926 --- /dev/null +++ b/core/res/res/drawable/pointer_nodrop_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_nodrop_large" + android:hotSpotX="10dp" + android:hotSpotY="10dp" /> diff --git a/core/res/res/drawable/pointer_text_large_icon.xml b/core/res/res/drawable/pointer_text_large_icon.xml new file mode 100644 index 000000000000..24d35b0ba2b4 --- /dev/null +++ b/core/res/res/drawable/pointer_text_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_text_large" + android:hotSpotX="30dp" + android:hotSpotY="32dp" /> diff --git a/core/res/res/drawable/pointer_top_left_diagonal_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_top_left_diagonal_double_arrow_large_icon.xml new file mode 100644 index 000000000000..270ccc9ce721 --- /dev/null +++ b/core/res/res/drawable/pointer_top_left_diagonal_double_arrow_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_top_left_diagonal_double_arrow_large" + android:hotSpotX="32dp" + android:hotSpotY="30dp" /> diff --git a/core/res/res/drawable/pointer_top_right_diagonal_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_top_right_diagonal_double_arrow_large_icon.xml new file mode 100644 index 000000000000..e350a4385d48 --- /dev/null +++ b/core/res/res/drawable/pointer_top_right_diagonal_double_arrow_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_top_right_diagonal_double_arrow_large" + android:hotSpotX="32dp" + android:hotSpotY="31dp" /> diff --git a/core/res/res/drawable/pointer_vertical_double_arrow_large_icon.xml b/core/res/res/drawable/pointer_vertical_double_arrow_large_icon.xml new file mode 100644 index 000000000000..65728ad3374d --- /dev/null +++ b/core/res/res/drawable/pointer_vertical_double_arrow_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_vertical_double_arrow_large" + android:hotSpotX="29dp" + android:hotSpotY="32dp" /> diff --git a/core/res/res/drawable/pointer_vertical_text_large_icon.xml b/core/res/res/drawable/pointer_vertical_text_large_icon.xml new file mode 100644 index 000000000000..48211cb7a17b --- /dev/null +++ b/core/res/res/drawable/pointer_vertical_text_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_vertical_text_large" + android:hotSpotX="32dp" + android:hotSpotY="30dp" /> diff --git a/core/res/res/drawable/pointer_zoom_in_large_icon.xml b/core/res/res/drawable/pointer_zoom_in_large_icon.xml new file mode 100644 index 000000000000..3eb89f5680c3 --- /dev/null +++ b/core/res/res/drawable/pointer_zoom_in_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_zoom_in_large" + android:hotSpotX="25dp" + android:hotSpotY="26dp" /> diff --git a/core/res/res/drawable/pointer_zoom_out_large_icon.xml b/core/res/res/drawable/pointer_zoom_out_large_icon.xml new file mode 100644 index 000000000000..df6412e049b2 --- /dev/null +++ b/core/res/res/drawable/pointer_zoom_out_large_icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" + android:bitmap="@drawable/pointer_zoom_out_large" + android:hotSpotX="26dp" + android:hotSpotY="26dp" /> diff --git a/core/res/res/layout/search_view.xml b/core/res/res/layout/search_view.xml index b5b5b277d84a..718e4a2dd604 100644 --- a/core/res/res/layout/search_view.xml +++ b/core/res/res/layout/search_view.xml @@ -81,7 +81,6 @@ android:layout_height="36dip" android:layout_width="0dp" android:layout_weight="1" - android:minWidth="@dimen/search_view_text_min_width" android:layout_gravity="bottom" android:paddingStart="@dimen/dropdownitem_text_padding_left" android:paddingEnd="@dimen/dropdownitem_text_padding_right" @@ -113,7 +112,7 @@ android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="match_parent"> - + <ImageView android:id="@+id/search_go_btn" android:layout_width="wrap_content" diff --git a/core/res/res/values-large/dimens.xml b/core/res/res/values-large/dimens.xml index 8cd614dfe4c9..69a1aa1a457d 100644 --- a/core/res/res/values-large/dimens.xml +++ b/core/res/res/values-large/dimens.xml @@ -24,9 +24,6 @@ <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 --> <dimen name="password_keyboard_height">48.0mm</dimen> - <!-- Minimum width of the search view text entry area. --> - <dimen name="search_view_text_min_width">192dip</dimen> - <item type="dimen" name="dialog_min_width_major">55%</item> <item type="dimen" name="dialog_min_width_minor">80%</item> diff --git a/core/res/res/values-mcc302-mnc220/config.xml b/core/res/res/values-mcc302-mnc220/config.xml index 09a63aac27fd..454e4b6b466a 100644 --- a/core/res/res/values-mcc302-mnc220/config.xml +++ b/core/res/res/values-mcc302-mnc220/config.xml @@ -37,7 +37,7 @@ Or string format of ApnSettingV3. note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" --> <string-array translatable="false" name="config_tether_apndata"> - <item>[ApnSettingV3]TELUS ISP,isp.telus.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,54</item> + <item>[ApnSettingV3]TELUS ISP,isp.telus.com,,,,,,,,,302,220,,DUN,IP,IP,true,0,,,,,,,gid,54</item> <item>[ApnSettingV3]Tethered Mobile Internet,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,50</item> <item>[ApnSettingV3]Tethered Public Mobile,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,4D4F</item> </string-array> diff --git a/core/res/res/values-w480dp/bools.xml b/core/res/res/values-w480dp/bools.xml index 3a463a6a77d0..c7df56213ba1 100644 --- a/core/res/res/values-w480dp/bools.xml +++ b/core/res/res/values-w480dp/bools.xml @@ -17,6 +17,5 @@ */ --> <resources> - <bool name="action_bar_embed_tabs_pre_jb">true</bool> <bool name="split_action_bar_is_narrow">false</bool> </resources> diff --git a/core/res/res/values-w480dp/config.xml b/core/res/res/values-w480dp/config.xml deleted file mode 100644 index 269a9b4c4c86..000000000000 --- a/core/res/res/values-w480dp/config.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2011, 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. -*/ ---> -<resources> - <bool name="config_allowActionMenuItemTextWithIcon">true</bool> -</resources> diff --git a/core/res/res/values-xlarge-land/dimens.xml b/core/res/res/values-xlarge-land/dimens.xml index 0b43a42e7ef4..38121787f60a 100644 --- a/core/res/res/values-xlarge-land/dimens.xml +++ b/core/res/res/values-xlarge-land/dimens.xml @@ -20,6 +20,4 @@ <!-- Default height of a key in the password keyboard for alpha --> <dimen name="password_keyboard_key_height_alpha">100dip</dimen> <dimen name="password_keyboard_key_height_numeric">75dip</dimen> - <!-- Minimum width of the search view text entry area. --> - <dimen name="search_view_text_min_width">256dip</dimen> </resources> diff --git a/core/res/res/values-xlarge/dimens.xml b/core/res/res/values-xlarge/dimens.xml index 29cea26c9fde..b13e74a4edde 100644 --- a/core/res/res/values-xlarge/dimens.xml +++ b/core/res/res/values-xlarge/dimens.xml @@ -25,9 +25,6 @@ <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 --> <dimen name="password_keyboard_height">48.0mm</dimen> - <!-- Minimum width of the search view text entry area. --> - <dimen name="search_view_text_min_width">192dip</dimen> - <item type="dimen" name="dialog_min_width_major">45%</item> <item type="dimen" name="dialog_min_width_minor">72%</item> </resources> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index f9f8162c1051..34a66d0312d1 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1026,9 +1026,6 @@ i <!-- ============== --> <eat-comment /> - <!-- Reference to the Pointer style --> - <attr name="pointerStyle" format="reference" /> - <!-- The drawable for accessibility focused views. --> <attr name="accessibilityFocusedDrawable" format="reference" /> diff --git a/core/res/res/values/bools.xml b/core/res/res/values/bools.xml index 457131a4f84a..5c50e7357120 100644 --- a/core/res/res/values/bools.xml +++ b/core/res/res/values/bools.xml @@ -19,7 +19,6 @@ <bool name="kg_center_small_widgets_vertically">false</bool> <bool name="kg_top_align_page_shrink_on_bouncer_visible">true</bool> <bool name="action_bar_embed_tabs">true</bool> - <bool name="action_bar_embed_tabs_pre_jb">false</bool> <bool name="split_action_bar_is_narrow">true</bool> <bool name="preferences_prefer_dual_pane">false</bool> <bool name="show_ongoing_ime_switcher">true</bool> diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index dad68ba030e1..af8ff2e4d8b9 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -173,4 +173,7 @@ <color name="Red_800">#ffb93221</color> <color name="chooser_service_row_background_color">#fff5f5f5</color> + + <!-- Status bar color for semi transparent mode. --> + <color name="system_bar_background_semi_transparent">#66000000</color> <!-- 40% black --> </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index caa20dc454a0..decb1effca4a 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1537,11 +1537,6 @@ it should be disabled in that locale's resources. --> <bool name="config_actionMenuItemAllCaps">true</bool> - <!-- Whether action menu items should obey the "withText" showAsAction - flag. This may be set to false for situations where space is - extremely limited. --> - <bool name="config_allowActionMenuItemTextWithIcon">false</bool> - <!-- Remote server that can provide NTP responses. --> <string translatable="false" name="config_ntpServer">2.android.pool.ntp.org</string> <!-- Normal polling frequency in milliseconds --> @@ -1965,6 +1960,7 @@ <item>com.android.server.notification.TopicPriorityExtractor</item> <item>com.android.server.notification.NotificationIntrusivenessExtractor</item> <item>com.android.server.notification.TopicVisibilityExtractor</item> + <item>com.android.server.notification.TopicImportanceExtractor</item> </string-array> <!-- Flag indicating that this device does not rotate and will always remain in its default @@ -2400,4 +2396,9 @@ The duplication is necessary, because this information is used before the features are available to the system.--> <bool name="config_freeformWindowManagement">false</bool> + + <!-- If set, this will force all windows to draw the status bar background, including the apps + that have not requested doing so (via the WindowManager.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS + flag). --> + <bool name="config_forceWindowDrawsStatusBarBackground">true</bool> </resources> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 7b4beccae0fc..b167711049f2 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -162,9 +162,6 @@ <!-- The minimum height of the content if there is a picture present with big picture --> <dimen name="notification_big_picture_content_min_height_with_picture">41dp</dimen> - <!-- Minimum width of the search view text entry area. --> - <dimen name="search_view_text_min_width">160dip</dimen> - <!-- Preferred width of the search view. --> <dimen name="search_view_preferred_width">320dip</dimen> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index d6dd8423cc5a..e5415dfb58cb 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3954,6 +3954,22 @@ <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description --> <string name="battery_saver_description">To help improve battery life, battery saver reduces your device’s performance and limits vibration, location services, and most background data. Email, messaging, and other apps that rely on syncing may not update unless you open them.\n\nBattery saver turns off automatically when your device is charging.</string> + + <!-- [CHAR LIMIT=100] Notification Importance slider: blocked importance level description --> + <string name="notification_importance_blocked">Blocked: Never show these notifications</string> + + <!-- [CHAR LIMIT=100] Notification Importance slider: low importance level description --> + <string name="notification_importance_low">Low: Silently show at the bottom of the notification list</string> + + <!-- [CHAR LIMIT=100] Notification Importance slider: normal importance level description --> + <string name="notification_importance_default">Normal: Silently show these notifications</string> + + <!-- [CHAR LIMIT=100] Notification Importance slider: high importance level description --> + <string name="notification_importance_high">High: Show at the top of the notifications list and make sound</string> + + <!-- [CHAR LIMIT=100] Notification Importance slider: max importance level description --> + <string name="notification_importance_max">Urgent: Peek onto the screen and make sound</string> + <!-- Zen mode condition - summary: time duration in minutes. [CHAR LIMIT=NONE] --> <plurals name="zen_mode_duration_minutes_summary"> <item quantity="one">For one minute (until <xliff:g id="formattedTime" example="10:00 PM">%2$s</xliff:g>)</item> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index e6f279d4d53c..9a4016bd5f9a 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -1368,6 +1368,42 @@ please see styles_device_defaults.xml. <item name="pointerIconGrabbing">@drawable/pointer_grabbing_icon</item> </style> + <style name="LargePointer"> + <item name="pointerIconArrow">@drawable/pointer_arrow_large_icon</item> + <item name="pointerIconSpotHover">@drawable/pointer_spot_hover_icon</item> + <item name="pointerIconSpotTouch">@drawable/pointer_spot_touch_icon</item> + <item name="pointerIconSpotAnchor">@drawable/pointer_spot_anchor_icon</item> + <item name="pointerIconHand">@drawable/pointer_hand_large_icon</item> + <item name="pointerIconContextMenu">@drawable/pointer_context_menu_large_icon</item> + <item name="pointerIconHelp">@drawable/pointer_help_large_icon</item> + <!-- TODO: create large wait icon. --> + <item name="pointerIconWait">@drawable/pointer_wait_icon</item> + <item name="pointerIconCell">@drawable/pointer_cell_large_icon</item> + <item name="pointerIconCrosshair">@drawable/pointer_crosshair_large_icon</item> + <item name="pointerIconText">@drawable/pointer_text_large_icon</item> + <item name="pointerIconVerticalText">@drawable/pointer_vertical_text_large_icon</item> + <item name="pointerIconAlias">@drawable/pointer_alias_large_icon</item> + <item name="pointerIconCopy">@drawable/pointer_copy_large_icon</item> + <item name="pointerIconAllScroll">@drawable/pointer_all_scroll_large_icon</item> + <item name="pointerIconNodrop">@drawable/pointer_nodrop_large_icon</item> + <item name="pointerIconHorizontalDoubleArrow"> + @drawable/pointer_horizontal_double_arrow_large_icon + </item> + <item name="pointerIconVerticalDoubleArrow"> + @drawable/pointer_vertical_double_arrow_large_icon + </item> + <item name="pointerIconTopRightDiagonalDoubleArrow"> + @drawable/pointer_top_right_diagonal_double_arrow_large_icon + </item> + <item name="pointerIconTopLeftDiagonalDoubleArrow"> + @drawable/pointer_top_left_diagonal_double_arrow_large_icon + </item> + <item name="pointerIconZoomIn">@drawable/pointer_zoom_in_large_icon</item> + <item name="pointerIconZoomOut">@drawable/pointer_zoom_out_large_icon</item> + <item name="pointerIconGrab">@drawable/pointer_grab_large_icon</item> + <item name="pointerIconGrabbing">@drawable/pointer_grabbing_large_icon</item> + </style> + <!-- Wifi dialog styles --> <!-- @hide --> <style name="wifi_item"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 16c9db1c7f2c..d92adc2e7994 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -227,7 +227,6 @@ <java-symbol type="attr" name="gestureOverlayViewStyle" /> <java-symbol type="attr" name="keyboardViewStyle" /> <java-symbol type="attr" name="numberPickerStyle" /> - <java-symbol type="attr" name="pointerStyle" /> <java-symbol type="attr" name="preferenceFrameLayoutStyle" /> <java-symbol type="attr" name="searchDialogTheme" /> <java-symbol type="attr" name="textAppearanceAutoCorrectionSuggestion" /> @@ -243,10 +242,8 @@ <java-symbol type="attr" name="isLightTheme"/> <java-symbol type="bool" name="action_bar_embed_tabs" /> - <java-symbol type="bool" name="action_bar_embed_tabs_pre_jb" /> <java-symbol type="bool" name="action_bar_expanded_action_views_exclusive" /> <java-symbol type="bool" name="config_avoidGfxAccel" /> - <java-symbol type="bool" name="config_allowActionMenuItemTextWithIcon" /> <java-symbol type="bool" name="config_bluetooth_address_validation" /> <java-symbol type="bool" name="config_bluetooth_sco_off_call" /> <java-symbol type="bool" name="config_bluetooth_le_peripheral_mode_supported" /> @@ -1424,6 +1421,8 @@ <java-symbol type="style" name="Theme.DeviceDefault.Dialog.NoFrame" /> <java-symbol type="style" name="Theme.IconMenu" /> <java-symbol type="style" name="Theme.DeviceDefault.VoiceInteractionSession" /> + <java-symbol type="style" name="Pointer" /> + <java-symbol type="style" name="LargePointer" /> <java-symbol type="attr" name="mediaRouteButtonStyle" /> <java-symbol type="attr" name="externalRouteEnabledDrawable" /> @@ -2087,6 +2086,11 @@ <java-symbol type="array" name="config_system_condition_providers" /> <java-symbol type="string" name="muted_by" /> <java-symbol type="string" name="zen_mode_alarm" /> + <java-symbol type="string" name="notification_importance_blocked" /> + <java-symbol type="string" name="notification_importance_low" /> + <java-symbol type="string" name="notification_importance_default" /> + <java-symbol type="string" name="notification_importance_high" /> + <java-symbol type="string" name="notification_importance_max" /> <java-symbol type="string" name="select_day" /> <java-symbol type="string" name="select_year" /> @@ -2347,6 +2351,8 @@ <java-symbol type="string" name="config_packagedKeyboardName" /> <java-symbol type="string" name="default_notification_topic_label" /> + <java-symbol type="bool" name="config_forceWindowDrawsStatusBarBackground" /> + <java-symbol type="color" name="system_bar_background_semi_transparent" /> <!-- EditText suggestion popup. --> <java-symbol type="id" name="suggestionContainer" /> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index d56674a7a34b..bf7718e7eeb7 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -428,9 +428,6 @@ please see themes_device_defaults.xml. <item name="fastScrollOverlayPosition">floating</item> <item name="fastScrollTextColor">@color/primary_text_dark</item> - <!-- Pointer style --> - <item name="pointerStyle">@style/Pointer</item> - <!-- Accessibility focused drawable --> <item name="accessibilityFocusedDrawable">@drawable/view_accessibility_focused</item> diff --git a/core/tests/coretests/src/android/content/pm/RegisteredServicesCacheTest.java b/core/tests/coretests/src/android/content/pm/RegisteredServicesCacheTest.java index 32b4557d123d..271c6392bdf4 100644 --- a/core/tests/coretests/src/android/content/pm/RegisteredServicesCacheTest.java +++ b/core/tests/coretests/src/android/content/pm/RegisteredServicesCacheTest.java @@ -188,7 +188,10 @@ public class RegisteredServicesCacheTest extends AndroidTestCase { private static RegisteredServicesCache.ServiceInfo<TestServiceType> newServiceInfo( TestServiceType type, int uid) { - return new RegisteredServicesCache.ServiceInfo<>(type, null, uid); + final ComponentInfo info = new ComponentInfo(); + info.applicationInfo = new ApplicationInfo(); + info.applicationInfo.uid = uid; + return new RegisteredServicesCache.ServiceInfo<>(type, info, null); } private void assertNotEmptyFileCreated(TestServicesCache cache, int userId) { diff --git a/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java b/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java index c279c8f24362..d133a12cc141 100644 --- a/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java +++ b/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java @@ -1191,4 +1191,25 @@ public class InputMethodUtilsTest extends InstrumentationTestCase { InputMethodUtils.buildInputMethodsAndSubtypesString(map))); } } + + @SmallTest + public void testConstructLocaleFromString() throws Exception { + assertEquals(new Locale("en"), InputMethodUtils.constructLocaleFromString("en")); + assertEquals(new Locale("en", "US"), InputMethodUtils.constructLocaleFromString("en_US")); + assertEquals(new Locale("en", "US", "POSIX"), + InputMethodUtils.constructLocaleFromString("en_US_POSIX")); + + // Special rewrite rule for "tl" for versions of Android earlier than Lollipop that did not + // support three letter language codes, and used "tl" (Tagalog) as the language string for + // "fil" (Filipino). + assertEquals(new Locale("fil"), InputMethodUtils.constructLocaleFromString("tl")); + assertEquals(new Locale("fil", "PH"), InputMethodUtils.constructLocaleFromString("tl_PH")); + assertEquals(new Locale("fil", "PH", "POSIX"), + InputMethodUtils.constructLocaleFromString("tl_PH_POSIX")); + + // So far rejecting an invalid/unexpected locale string is out of the scope of this method. + assertEquals(new Locale("a"), InputMethodUtils.constructLocaleFromString("a")); + assertEquals(new Locale("a b c"), InputMethodUtils.constructLocaleFromString("a b c")); + assertEquals(new Locale("en-US"), InputMethodUtils.constructLocaleFromString("en-US")); + } } diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk index fc4916c79d09..d98497bc046b 100644 --- a/libs/hwui/Android.mk +++ b/libs/hwui/Android.mk @@ -30,7 +30,6 @@ hwui_src_files := \ utils/StringUtils.cpp \ utils/TestWindowContext.cpp \ utils/VectorDrawableUtils.cpp \ - utils/TestUtils.cpp \ AmbientShadow.cpp \ AnimationContext.cpp \ Animator.cpp \ @@ -90,6 +89,9 @@ hwui_src_files := \ VectorDrawablePath.cpp \ protos/hwui.proto +hwui_test_common_src_files := \ + tests/common/TestUtils.cpp + hwui_cflags := \ -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES \ -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" \ @@ -180,8 +182,8 @@ LOCAL_CFLAGS := \ -DHWUI_NULL_GPU LOCAL_SRC_FILES := \ $(hwui_src_files) \ - tests/nullegl.cpp \ - tests/nullgles.cpp + tests/common/nullegl.cpp \ + tests/common/nullgles.cpp LOCAL_C_INCLUDES := $(hwui_c_includes) $(call hwui_proto_include) LOCAL_EXPORT_C_INCLUDE_DIRS := $(hwui_c_includes) $(call hwui_proto_include) @@ -215,28 +217,29 @@ LOCAL_CFLAGS := \ -DHWUI_NULL_GPU LOCAL_SRC_FILES += \ - unit_tests/CanvasStateTests.cpp \ - unit_tests/ClipAreaTests.cpp \ - unit_tests/DamageAccumulatorTests.cpp \ - unit_tests/DeviceInfoTests.cpp \ - unit_tests/FatVectorTests.cpp \ - unit_tests/LayerUpdateQueueTests.cpp \ - unit_tests/LinearAllocatorTests.cpp \ - unit_tests/VectorDrawableTests.cpp \ - unit_tests/OffscreenBufferPoolTests.cpp \ - unit_tests/StringUtilsTests.cpp + $(hwui_test_common_src_files) \ + tests/unit/CanvasStateTests.cpp \ + tests/unit/ClipAreaTests.cpp \ + tests/unit/DamageAccumulatorTests.cpp \ + tests/unit/DeviceInfoTests.cpp \ + tests/unit/FatVectorTests.cpp \ + tests/unit/LayerUpdateQueueTests.cpp \ + tests/unit/LinearAllocatorTests.cpp \ + tests/unit/VectorDrawableTests.cpp \ + tests/unit/OffscreenBufferPoolTests.cpp \ + tests/unit/StringUtilsTests.cpp ifeq (true, $(HWUI_NEW_OPS)) LOCAL_SRC_FILES += \ - unit_tests/BakedOpStateTests.cpp \ - unit_tests/RecordingCanvasTests.cpp \ - unit_tests/OpReordererTests.cpp + tests/unit/BakedOpStateTests.cpp \ + tests/unit/RecordingCanvasTests.cpp \ + tests/unit/OpReordererTests.cpp endif include $(BUILD_NATIVE_TEST) # ------------------------ -# test app +# Macro-bench app # ------------------------ include $(CLEAR_VARS) @@ -255,11 +258,12 @@ LOCAL_CFLAGS := $(hwui_cflags) LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static LOCAL_SRC_FILES += \ - tests/TestContext.cpp \ - tests/TestSceneRunner.cpp \ - tests/main.cpp + $(hwui_test_common_src_files) \ + tests/macrobench/TestContext.cpp \ + tests/macrobench/TestSceneRunner.cpp \ + tests/macrobench/main.cpp -LOCAL_SRC_FILES += $(call all-cpp-files-under, tests/scenes) +LOCAL_SRC_FILES += $(call all-cpp-files-under, tests/common/scenes) include $(BUILD_EXECUTABLE) @@ -285,14 +289,15 @@ LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static_null_gpu LOCAL_STATIC_LIBRARIES := libbenchmark libbase LOCAL_SRC_FILES += \ - microbench/DisplayListCanvasBench.cpp \ - microbench/LinearAllocatorBench.cpp \ - microbench/PathParserBench.cpp \ - microbench/ShadowBench.cpp + $(hwui_test_common_src_files) \ + tests/microbench/DisplayListCanvasBench.cpp \ + tests/microbench/LinearAllocatorBench.cpp \ + tests/microbench/PathParserBench.cpp \ + tests/microbench/ShadowBench.cpp ifeq (true, $(HWUI_NEW_OPS)) LOCAL_SRC_FILES += \ - microbench/OpReordererBench.cpp + tests/microbench/OpReordererBench.cpp endif include $(BUILD_EXECUTABLE) diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp index 996ac8ebc447..51f16523966b 100644 --- a/libs/hwui/TextDropShadowCache.cpp +++ b/libs/hwui/TextDropShadowCache.cpp @@ -83,7 +83,7 @@ int ShadowText::compare(const ShadowText& lhs, const ShadowText& rhs) { if (!lhs.positions) return -1; if (!rhs.positions) return +1; - return memcmp(lhs.positions, rhs.positions, lhs.glyphCount << 1); + return memcmp(lhs.positions, rhs.positions, lhs.glyphCount * sizeof(float) * 2); } return 0; @@ -169,7 +169,7 @@ void TextDropShadowCache::clear() { ShadowTexture* TextDropShadowCache::get(const SkPaint* paint, const char* glyphs, int numGlyphs, float radius, const float* positions) { - ShadowText entry(paint, radius, numGlyphs * 2, glyphs, positions); + ShadowText entry(paint, radius, numGlyphs, glyphs, positions); ShadowTexture* texture = mCache.get(entry); if (!texture) { diff --git a/libs/hwui/tests/TestScene.h b/libs/hwui/tests/common/TestScene.h index b5d8954652a3..b5d8954652a3 100644 --- a/libs/hwui/tests/TestScene.h +++ b/libs/hwui/tests/common/TestScene.h diff --git a/libs/hwui/utils/TestUtils.cpp b/libs/hwui/tests/common/TestUtils.cpp index 6cef85203352..6cef85203352 100644 --- a/libs/hwui/utils/TestUtils.cpp +++ b/libs/hwui/tests/common/TestUtils.cpp diff --git a/libs/hwui/utils/TestUtils.h b/libs/hwui/tests/common/TestUtils.h index 9c1c0b9d2c08..9c1c0b9d2c08 100644 --- a/libs/hwui/utils/TestUtils.h +++ b/libs/hwui/tests/common/TestUtils.h diff --git a/libs/hwui/tests/nullegl.cpp b/libs/hwui/tests/common/nullegl.cpp index b6cc2f247627..b6cc2f247627 100644 --- a/libs/hwui/tests/nullegl.cpp +++ b/libs/hwui/tests/common/nullegl.cpp diff --git a/libs/hwui/tests/nullgles.cpp b/libs/hwui/tests/common/nullgles.cpp index f8e8c98c20ba..f8e8c98c20ba 100644 --- a/libs/hwui/tests/nullgles.cpp +++ b/libs/hwui/tests/common/nullgles.cpp diff --git a/libs/hwui/tests/scenes/HwLayerAnimation.cpp b/libs/hwui/tests/common/scenes/HwLayerAnimation.cpp index e316eca79be8..e316eca79be8 100644 --- a/libs/hwui/tests/scenes/HwLayerAnimation.cpp +++ b/libs/hwui/tests/common/scenes/HwLayerAnimation.cpp diff --git a/libs/hwui/tests/scenes/ListViewAnimation.cpp b/libs/hwui/tests/common/scenes/ListViewAnimation.cpp index 27adb125fcf9..27adb125fcf9 100644 --- a/libs/hwui/tests/scenes/ListViewAnimation.cpp +++ b/libs/hwui/tests/common/scenes/ListViewAnimation.cpp diff --git a/libs/hwui/tests/scenes/OvalAnimation.cpp b/libs/hwui/tests/common/scenes/OvalAnimation.cpp index 936aba184c88..936aba184c88 100644 --- a/libs/hwui/tests/scenes/OvalAnimation.cpp +++ b/libs/hwui/tests/common/scenes/OvalAnimation.cpp diff --git a/libs/hwui/tests/scenes/PartialDamageAnimation.cpp b/libs/hwui/tests/common/scenes/PartialDamageAnimation.cpp index c31ddd1d531b..c31ddd1d531b 100644 --- a/libs/hwui/tests/scenes/PartialDamageAnimation.cpp +++ b/libs/hwui/tests/common/scenes/PartialDamageAnimation.cpp diff --git a/libs/hwui/tests/scenes/RecentsAnimation.cpp b/libs/hwui/tests/common/scenes/RecentsAnimation.cpp index 5d4ef9663d34..5d4ef9663d34 100644 --- a/libs/hwui/tests/scenes/RecentsAnimation.cpp +++ b/libs/hwui/tests/common/scenes/RecentsAnimation.cpp diff --git a/libs/hwui/tests/scenes/RectGridAnimation.cpp b/libs/hwui/tests/common/scenes/RectGridAnimation.cpp index a1f04d67c785..a1f04d67c785 100644 --- a/libs/hwui/tests/scenes/RectGridAnimation.cpp +++ b/libs/hwui/tests/common/scenes/RectGridAnimation.cpp diff --git a/libs/hwui/tests/scenes/SaveLayerAnimation.cpp b/libs/hwui/tests/common/scenes/SaveLayerAnimation.cpp index c73e97ba003c..c73e97ba003c 100644 --- a/libs/hwui/tests/scenes/SaveLayerAnimation.cpp +++ b/libs/hwui/tests/common/scenes/SaveLayerAnimation.cpp diff --git a/libs/hwui/tests/scenes/ShadowGrid2Animation.cpp b/libs/hwui/tests/common/scenes/ShadowGrid2Animation.cpp index 26c86aa6f9d5..26c86aa6f9d5 100644 --- a/libs/hwui/tests/scenes/ShadowGrid2Animation.cpp +++ b/libs/hwui/tests/common/scenes/ShadowGrid2Animation.cpp diff --git a/libs/hwui/tests/scenes/ShadowGridAnimation.cpp b/libs/hwui/tests/common/scenes/ShadowGridAnimation.cpp index ee3c590c4e0d..ee3c590c4e0d 100644 --- a/libs/hwui/tests/scenes/ShadowGridAnimation.cpp +++ b/libs/hwui/tests/common/scenes/ShadowGridAnimation.cpp diff --git a/libs/hwui/tests/scenes/TestSceneBase.h b/libs/hwui/tests/common/scenes/TestSceneBase.h index a208509edf0e..8a2414971515 100644 --- a/libs/hwui/tests/scenes/TestSceneBase.h +++ b/libs/hwui/tests/common/scenes/TestSceneBase.h @@ -19,10 +19,10 @@ #include "DisplayListCanvas.h" #include "RecordingCanvas.h" #include "RenderNode.h" -#include "tests/Benchmark.h" -#include "tests/TestContext.h" -#include "tests/TestScene.h" -#include "utils/TestUtils.h" +#include "tests/macrobench/Benchmark.h" +#include "tests/macrobench/TestContext.h" +#include "tests/common/TestScene.h" +#include "tests/common/TestUtils.h" #include <functional> diff --git a/libs/hwui/tests/Benchmark.h b/libs/hwui/tests/macrobench/Benchmark.h index 3f87d7fc34ce..aad8eb3716a6 100644 --- a/libs/hwui/tests/Benchmark.h +++ b/libs/hwui/tests/macrobench/Benchmark.h @@ -16,7 +16,7 @@ #ifndef TESTS_BENCHMARK_H #define TESTS_BENCHMARK_H -#include "TestScene.h" +#include "tests/common/TestScene.h" #include <string> #include <vector> diff --git a/libs/hwui/tests/TestContext.cpp b/libs/hwui/tests/macrobench/TestContext.cpp index ba763a8def62..ba763a8def62 100644 --- a/libs/hwui/tests/TestContext.cpp +++ b/libs/hwui/tests/macrobench/TestContext.cpp diff --git a/libs/hwui/tests/TestContext.h b/libs/hwui/tests/macrobench/TestContext.h index 2bbe5dffd9b8..2bbe5dffd9b8 100644 --- a/libs/hwui/tests/TestContext.h +++ b/libs/hwui/tests/macrobench/TestContext.h diff --git a/libs/hwui/tests/TestSceneRunner.cpp b/libs/hwui/tests/macrobench/TestSceneRunner.cpp index 0376e109052d..1e1c6a1e318a 100644 --- a/libs/hwui/tests/TestSceneRunner.cpp +++ b/libs/hwui/tests/macrobench/TestSceneRunner.cpp @@ -18,7 +18,7 @@ #include "Benchmark.h" #include "RenderNode.h" #include "TestContext.h" -#include "scenes/TestSceneBase.h" +#include "tests/common/scenes/TestSceneBase.h" #include "renderthread/RenderProxy.h" #include "renderthread/RenderTask.h" diff --git a/libs/hwui/tests/how_to_run.txt b/libs/hwui/tests/macrobench/how_to_run.txt index b051768f3262..b051768f3262 100644 --- a/libs/hwui/tests/how_to_run.txt +++ b/libs/hwui/tests/macrobench/how_to_run.txt diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/macrobench/main.cpp index 48566e8f6ecd..48566e8f6ecd 100644 --- a/libs/hwui/tests/main.cpp +++ b/libs/hwui/tests/macrobench/main.cpp diff --git a/libs/hwui/microbench/DisplayListCanvasBench.cpp b/libs/hwui/tests/microbench/DisplayListCanvasBench.cpp index 4be1f992e399..2e59eb450c9f 100644 --- a/libs/hwui/microbench/DisplayListCanvasBench.cpp +++ b/libs/hwui/tests/microbench/DisplayListCanvasBench.cpp @@ -22,8 +22,8 @@ #else #include "DisplayListCanvas.h" #endif -#include "microbench/MicroBench.h" -#include "utils/TestUtils.h" +#include "tests/common/TestUtils.h" +#include "tests/microbench/MicroBench.h" using namespace android; using namespace android::uirenderer; diff --git a/libs/hwui/microbench/LinearAllocatorBench.cpp b/libs/hwui/tests/microbench/LinearAllocatorBench.cpp index 75f57cbd6021..28513e438fe1 100644 --- a/libs/hwui/microbench/LinearAllocatorBench.cpp +++ b/libs/hwui/tests/microbench/LinearAllocatorBench.cpp @@ -16,8 +16,8 @@ #include <benchmark/Benchmark.h> +#include "tests/microbench/MicroBench.h" #include "utils/LinearAllocator.h" -#include "microbench/MicroBench.h" #include <vector> diff --git a/libs/hwui/microbench/MicroBench.h b/libs/hwui/tests/microbench/MicroBench.h index f05e92cd86d1..f05e92cd86d1 100644 --- a/libs/hwui/microbench/MicroBench.h +++ b/libs/hwui/tests/microbench/MicroBench.h diff --git a/libs/hwui/microbench/OpReordererBench.cpp b/libs/hwui/tests/microbench/OpReordererBench.cpp index 53b64c32ce52..406bfcc684b1 100644 --- a/libs/hwui/microbench/OpReordererBench.cpp +++ b/libs/hwui/tests/microbench/OpReordererBench.cpp @@ -23,7 +23,7 @@ #include "OpReorderer.h" #include "RecordedOp.h" #include "RecordingCanvas.h" -#include "utils/TestUtils.h" +#include "tests/common/TestUtils.h" #include "Vector.h" #include "microbench/MicroBench.h" diff --git a/libs/hwui/microbench/PathParserBench.cpp b/libs/hwui/tests/microbench/PathParserBench.cpp index 3d9fafac6c93..3d9fafac6c93 100644 --- a/libs/hwui/microbench/PathParserBench.cpp +++ b/libs/hwui/tests/microbench/PathParserBench.cpp diff --git a/libs/hwui/microbench/ShadowBench.cpp b/libs/hwui/tests/microbench/ShadowBench.cpp index 1b0f5eae70a0..98ec4d9b8f9d 100644 --- a/libs/hwui/microbench/ShadowBench.cpp +++ b/libs/hwui/tests/microbench/ShadowBench.cpp @@ -21,7 +21,7 @@ #include "Vector.h" #include "VertexBuffer.h" #include "TessellationCache.h" -#include "microbench/MicroBench.h" +#include "tests/microbench/MicroBench.h" #include <SkPath.h> diff --git a/libs/hwui/microbench/how_to_run.txt b/libs/hwui/tests/microbench/how_to_run.txt index e6f80b278276..e6f80b278276 100755 --- a/libs/hwui/microbench/how_to_run.txt +++ b/libs/hwui/tests/microbench/how_to_run.txt diff --git a/libs/hwui/unit_tests/BakedOpStateTests.cpp b/libs/hwui/tests/unit/BakedOpStateTests.cpp index 7ad2f9bdbb67..de14abf6a89b 100644 --- a/libs/hwui/unit_tests/BakedOpStateTests.cpp +++ b/libs/hwui/tests/unit/BakedOpStateTests.cpp @@ -18,7 +18,7 @@ #include <BakedOpState.h> #include <RecordedOp.h> -#include <utils/TestUtils.h> +#include <tests/common/TestUtils.h> namespace android { namespace uirenderer { diff --git a/libs/hwui/unit_tests/CanvasStateTests.cpp b/libs/hwui/tests/unit/CanvasStateTests.cpp index dfbf6d358ce5..dfbf6d358ce5 100644 --- a/libs/hwui/unit_tests/CanvasStateTests.cpp +++ b/libs/hwui/tests/unit/CanvasStateTests.cpp diff --git a/libs/hwui/unit_tests/ClipAreaTests.cpp b/libs/hwui/tests/unit/ClipAreaTests.cpp index d6192df08bc3..d6192df08bc3 100644 --- a/libs/hwui/unit_tests/ClipAreaTests.cpp +++ b/libs/hwui/tests/unit/ClipAreaTests.cpp diff --git a/libs/hwui/unit_tests/DamageAccumulatorTests.cpp b/libs/hwui/tests/unit/DamageAccumulatorTests.cpp index 29354a79efbd..29354a79efbd 100644 --- a/libs/hwui/unit_tests/DamageAccumulatorTests.cpp +++ b/libs/hwui/tests/unit/DamageAccumulatorTests.cpp diff --git a/libs/hwui/unit_tests/DeviceInfoTests.cpp b/libs/hwui/tests/unit/DeviceInfoTests.cpp index 17236bdf0bf7..17236bdf0bf7 100644 --- a/libs/hwui/unit_tests/DeviceInfoTests.cpp +++ b/libs/hwui/tests/unit/DeviceInfoTests.cpp diff --git a/libs/hwui/unit_tests/FatVectorTests.cpp b/libs/hwui/tests/unit/FatVectorTests.cpp index c6ccf4dd9bea..64b0ba13562d 100644 --- a/libs/hwui/unit_tests/FatVectorTests.cpp +++ b/libs/hwui/tests/unit/FatVectorTests.cpp @@ -17,7 +17,7 @@ #include <gtest/gtest.h> #include <utils/FatVector.h> -#include <utils/TestUtils.h> +#include <tests/common/TestUtils.h> using namespace android; using namespace android::uirenderer; diff --git a/libs/hwui/unit_tests/LayerUpdateQueueTests.cpp b/libs/hwui/tests/unit/LayerUpdateQueueTests.cpp index cc15cc6d2628..8b0e91c77396 100644 --- a/libs/hwui/unit_tests/LayerUpdateQueueTests.cpp +++ b/libs/hwui/tests/unit/LayerUpdateQueueTests.cpp @@ -19,7 +19,7 @@ #include <LayerUpdateQueue.h> #include <RenderNode.h> -#include <utils/TestUtils.h> +#include <tests/common/TestUtils.h> namespace android { namespace uirenderer { diff --git a/libs/hwui/unit_tests/LinearAllocatorTests.cpp b/libs/hwui/tests/unit/LinearAllocatorTests.cpp index 0591db628bd1..78d65ddaa19d 100644 --- a/libs/hwui/unit_tests/LinearAllocatorTests.cpp +++ b/libs/hwui/tests/unit/LinearAllocatorTests.cpp @@ -17,7 +17,7 @@ #include <gtest/gtest.h> #include <utils/LinearAllocator.h> -#include <utils/TestUtils.h> +#include <tests/common/TestUtils.h> using namespace android; using namespace android::uirenderer; diff --git a/libs/hwui/unit_tests/OffscreenBufferPoolTests.cpp b/libs/hwui/tests/unit/OffscreenBufferPoolTests.cpp index de86aedfa26a..2187654fb36c 100644 --- a/libs/hwui/unit_tests/OffscreenBufferPoolTests.cpp +++ b/libs/hwui/tests/unit/OffscreenBufferPoolTests.cpp @@ -17,7 +17,7 @@ #include <gtest/gtest.h> #include <renderstate/OffscreenBufferPool.h> -#include <utils/TestUtils.h> +#include <tests/common/TestUtils.h> using namespace android; using namespace android::uirenderer; diff --git a/libs/hwui/unit_tests/OpReordererTests.cpp b/libs/hwui/tests/unit/OpReordererTests.cpp index 2ce1d0a5db7f..98a430a0ef10 100644 --- a/libs/hwui/unit_tests/OpReordererTests.cpp +++ b/libs/hwui/tests/unit/OpReordererTests.cpp @@ -21,7 +21,7 @@ #include <OpReorderer.h> #include <RecordedOp.h> #include <RecordingCanvas.h> -#include <utils/TestUtils.h> +#include <tests/common/TestUtils.h> #include <unordered_map> diff --git a/libs/hwui/unit_tests/RecordingCanvasTests.cpp b/libs/hwui/tests/unit/RecordingCanvasTests.cpp index 81f0851a6174..2449ce870b95 100644 --- a/libs/hwui/unit_tests/RecordingCanvasTests.cpp +++ b/libs/hwui/tests/unit/RecordingCanvasTests.cpp @@ -18,7 +18,7 @@ #include <RecordedOp.h> #include <RecordingCanvas.h> -#include <utils/TestUtils.h> +#include <tests/common/TestUtils.h> namespace android { namespace uirenderer { diff --git a/libs/hwui/unit_tests/StringUtilsTests.cpp b/libs/hwui/tests/unit/StringUtilsTests.cpp index 6b2e265a61ff..6b2e265a61ff 100644 --- a/libs/hwui/unit_tests/StringUtilsTests.cpp +++ b/libs/hwui/tests/unit/StringUtilsTests.cpp diff --git a/libs/hwui/unit_tests/VectorDrawableTests.cpp b/libs/hwui/tests/unit/VectorDrawableTests.cpp index 77dd73acff10..77dd73acff10 100644 --- a/libs/hwui/unit_tests/VectorDrawableTests.cpp +++ b/libs/hwui/tests/unit/VectorDrawableTests.cpp diff --git a/libs/hwui/unit_tests/how_to_run.txt b/libs/hwui/tests/unit/how_to_run.txt index c11d6eb33358..c11d6eb33358 100755 --- a/libs/hwui/unit_tests/how_to_run.txt +++ b/libs/hwui/tests/unit/how_to_run.txt diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp index bd6af788bcf7..6a1167a02c0b 100644 --- a/libs/input/PointerController.cpp +++ b/libs/input/PointerController.cpp @@ -91,7 +91,14 @@ PointerController::PointerController(const sp<PointerControllerPolicyInterface>& mLocked.buttonState = 0; + mPolicy->loadPointerIcon(&mLocked.pointerIcon); + loadResources(); + + if (mLocked.pointerIcon.isValid()) { + mLocked.pointerIconChanged = true; + updatePointerLocked(); + } } PointerController::~PointerController() { @@ -325,6 +332,23 @@ void PointerController::setInactivityTimeout(InactivityTimeout inactivityTimeout } } +void PointerController::reloadPointerResources() { + AutoMutex _l(mLock); + + loadResources(); + + if (mLocked.presentation == PRESENTATION_POINTER) { + mLocked.additionalMouseResources.clear(); + mLocked.animationResources.clear(); + mPolicy->loadPointerIcon(&mLocked.pointerIcon); + mPolicy->loadAdditionalMouseResources(&mLocked.additionalMouseResources, + &mLocked.animationResources); + } + + mLocked.presentationChanged = true; + updatePointerLocked(); +} + void PointerController::setDisplayViewport(int32_t width, int32_t height, int32_t orientation) { AutoMutex _l(mLock); @@ -415,15 +439,6 @@ void PointerController::updatePointerShape(int32_t iconId) { } } -void PointerController::setPointerIcon(const SpriteIcon& icon) { - AutoMutex _l(mLock); - - mLocked.pointerIcon = icon.copy(); - mLocked.pointerIconChanged = true; - - updatePointerLocked(); -} - void PointerController::handleMessage(const Message& message) { switch (message.what) { case MSG_INACTIVITY_TIMEOUT: diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h index b6c01d2903a9..4fd2d8503272 100644 --- a/libs/input/PointerController.h +++ b/libs/input/PointerController.h @@ -62,6 +62,7 @@ protected: virtual ~PointerControllerPolicyInterface() { } public: + virtual void loadPointerIcon(SpriteIcon* icon) = 0; virtual void loadPointerResources(PointerResources* outResources) = 0; virtual void loadAdditionalMouseResources(std::map<int32_t, SpriteIcon>* outResources, std::map<int32_t, PointerAnimation>* outAnimationResources) = 0; @@ -105,8 +106,8 @@ public: void updatePointerShape(int32_t iconId); void setDisplayViewport(int32_t width, int32_t height, int32_t orientation); - void setPointerIcon(const SpriteIcon& icon); void setInactivityTimeout(InactivityTimeout inactivityTimeout); + void reloadPointerResources(); private: static const size_t MAX_RECYCLED_SPRITES = 12; diff --git a/media/java/android/media/MediaMetadataEditor.java b/media/java/android/media/MediaMetadataEditor.java index 566b93f7c2e9..877c8729543e 100644 --- a/media/java/android/media/MediaMetadataEditor.java +++ b/media/java/android/media/MediaMetadataEditor.java @@ -73,7 +73,8 @@ import android.util.SparseIntArray; /** * Applies all of the metadata changes that have been set since the MediaMetadataEditor instance - * was created or since {@link #clear()} was called. + * was created or since {@link #clear()} was called. Subclasses should synchronize on + * {@code this} for thread safety. */ public abstract void apply(); diff --git a/packages/DocumentsUI/res/values/config.xml b/packages/DocumentsUI/res/values/config.xml index ad419aabca28..ff28e158238a 100644 --- a/packages/DocumentsUI/res/values/config.xml +++ b/packages/DocumentsUI/res/values/config.xml @@ -15,6 +15,9 @@ --> <resources> + <!-- Allow Advanced Devices default value to be customised --> + <bool name="config_defaultAdvancedDevices">false</bool> + <bool name="productivity_device">true</bool> <!-- Intentionally unset. Vendors should set this in an overlay. --> <string name="trusted_quick_viewer_package"></string> diff --git a/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java b/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java index e6c5ae23c4f5..113e9d7f7357 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java +++ b/packages/DocumentsUI/src/com/android/documentsui/LocalPreferences.java @@ -24,8 +24,10 @@ public class LocalPreferences { private static final String KEY_FILE_SIZE = "fileSize"; public static boolean getDisplayAdvancedDevices(Context context) { + boolean defaultAdvanced = context.getResources() + .getBoolean(R.bool.config_defaultAdvancedDevices); return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(KEY_ADVANCED_DEVICES, false); + .getBoolean(KEY_ADVANCED_DEVICES, defaultAdvanced); } public static boolean getDisplayFileSize(Context context) { diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/dirlist/MultiSelectManager_SelectionTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/dirlist/MultiSelectManager_SelectionTest.java index 72fc10814e72..030ac6c68c6d 100644 --- a/packages/DocumentsUI/tests/src/com/android/documentsui/dirlist/MultiSelectManager_SelectionTest.java +++ b/packages/DocumentsUI/tests/src/com/android/documentsui/dirlist/MultiSelectManager_SelectionTest.java @@ -22,7 +22,7 @@ import android.test.suitebuilder.annotation.SmallTest; import com.android.documentsui.dirlist.MultiSelectManager.Selection; @SmallTest -public class MultiSelectManager_SelectionTest extends AndroidTestCase{ +public class MultiSelectManager_SelectionTest extends AndroidTestCase { private Selection selection; diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java index a045d06facf0..ed617e71aeb2 100644 --- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java +++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java @@ -24,6 +24,9 @@ import android.os.OperationCanceledException; import android.test.InstrumentationTestCase; import java.io.IOException; +import java.util.concurrent.Callable; +import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; @RealDeviceTest public class MtpManagerTest extends InstrumentationTestCase { @@ -53,20 +56,23 @@ public class MtpManagerTest extends InstrumentationTestCase { public void testCancelEvent() throws Exception { final CancellationSignal signal = new CancellationSignal(); - final Thread thread = new Thread() { - @Override - public void run() { - try { - mManager.readEvent(mUsbDevice.getDeviceId(), signal); - } catch (OperationCanceledException | IOException e) { - getInstrumentation().show(e.getMessage()); - } - } - }; + final FutureTask<Boolean> future = new FutureTask<Boolean>( + new Callable<Boolean>() { + @Override + public Boolean call() throws IOException { + try { + mManager.readEvent(mUsbDevice.getDeviceId(), signal); + return false; + } catch (OperationCanceledException exception) { + return true; + } + } + }); + final Thread thread = new Thread(future); thread.start(); Thread.sleep(TIMEOUT_MS); signal.cancel(); - thread.join(TIMEOUT_MS); + assertTrue(future.get(TIMEOUT_MS, TimeUnit.MILLISECONDS)); } private Context getContext() { diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java index 3e64f9a2917a..4e4cf7833dd0 100644 --- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java +++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestResultInstrumentation.java @@ -23,6 +23,10 @@ import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestListener; +/** + * Instrumentation that can show the test result in the TestResultActivity. + * It's useful when it runs testcases with a real USB device and could not use USB port for ADB. + */ public class TestResultInstrumentation extends InstrumentationTestRunner implements TestListener { private boolean mHasError = false; diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestUtil.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestUtil.java index e6c12cb9e10b..f91032147fff 100644 --- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestUtil.java +++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/TestUtil.java @@ -33,7 +33,7 @@ import junit.framework.Assert; /** * Static utility methods for testing. */ -class TestUtil { +final class TestUtil { private static final String ACTION_USB_PERMISSION = "com.android.mtp.USB_PERMISSION"; @@ -42,12 +42,11 @@ class TestUtil { /** * Requests permission for a MTP device and returns the first MTP device that has at least one * storage. - * @throws Exception */ static UsbDevice setupMtpDevice( TestResultInstrumentation instrumentation, UsbManager usbManager, - MtpManager manager) throws Exception { + MtpManager manager) throws InterruptedException, IOException { for (int i = 0; i < 2; i++) { final UsbDevice device = findMtpDevice(instrumentation, usbManager); manager.openDevice(device.getDeviceId()); @@ -121,7 +120,7 @@ class TestUtil { private static void waitForStorages( TestResultInstrumentation instrumentation, MtpManager manager, - int deviceId) throws Exception { + int deviceId) throws IOException, InterruptedException { while (true) { if (manager.getRoots(deviceId).length == 0) { instrumentation.show("Wait for storages."); diff --git a/packages/SettingsLib/res/values/arrays.xml b/packages/SettingsLib/res/values/arrays.xml index a52ed698c9f4..4e88c1c092a4 100644 --- a/packages/SettingsLib/res/values/arrays.xml +++ b/packages/SettingsLib/res/values/arrays.xml @@ -78,4 +78,306 @@ <!-- Status message of Wi-Fi when connectiong is being verified. --> <item>Temporarily avoiding poor connection</item> </string-array> + + <!-- Titles for HDCP checking preference. [CHAR LIMIT=35] --> + <string-array name="hdcp_checking_titles"> + <item>Never check</item> + <item>Check for DRM content only</item> + <item>Always check</item> + </string-array> + + <!-- Values for HDCP checking preference. --> + <string-array name="hdcp_checking_values" translatable="false" > + <item>never</item> + <item>drm-only</item> + <item>always</item> + </string-array> + + <!-- Summaries for HDCP checking preference. [CHAR LIMIT=100]--> + <string-array name="hdcp_checking_summaries" > + <item>Never use HDCP checking</item> + <item>Use HDCP checking for DRM content only</item> + <item>Always use HDCP checking</item> + </string-array> + + <!-- Titles for logd limit size selection preference. [CHAR LIMIT=14] --> + <string-array name="select_logd_size_titles"> + <item>64K</item> + <item>256K</item> + <item>1M</item> + <item>4M</item> + <item>16M</item> + </string-array> + + <!-- Titles for logd limit size lowram selection preference. [CHAR LIMIT=14] --> + <string-array name="select_logd_size_lowram_titles"> + <item>64K</item> + <item>256K</item> + <item>1M</item> + </string-array> + + <!-- Values for logd limit size selection preference. --> + <string-array name="select_logd_size_values" translatable="false" > + <item>65536</item> + <item>262144</item> + <item>1048576</item> + <item>4194304</item> + <item>16777216</item> + </string-array> + + <!-- Summaries for logd limit size selection preference. [CHAR LIMIT=30]--> + <string-array name="select_logd_size_summaries" > + <item>64K per log buffer</item> + <item>256K per log buffer</item> + <item>1M per log buffer</item> + <item>4M per log buffer</item> + <item>16M per log buffer</item> + </string-array> + + <!-- Titles for window animation scale preference. [CHAR LIMIT=35] --> + <string-array name="window_animation_scale_entries"> + <item>Animation off</item> + <item>Animation scale .5x</item> + <item>Animation scale 1x</item> + <item>Animation scale 1.5x</item> + <item>Animation scale 2x</item> + <item>Animation scale 5x</item> + <item>Animation scale 10x</item> + </string-array> + + <!-- Values for window animation scale preference. --> + <string-array name="window_animation_scale_values" translatable="false" > + <item>0</item> + <item>.5</item> + <item>1</item> + <item>1.5</item> + <item>2</item> + <item>5</item> + <item>10</item> + </string-array> + + <!-- Titles for transition animation scale preference. [CHAR LIMIT=35] --> + <string-array name="transition_animation_scale_entries"> + <item>Animation off</item> + <item>Animation scale .5x</item> + <item>Animation scale 1x</item> + <item>Animation scale 1.5x</item> + <item>Animation scale 2x</item> + <item>Animation scale 5x</item> + <item>Animation scale 10x</item> + </string-array> + + <!-- Values for transition animation scale preference. --> + <string-array name="transition_animation_scale_values" translatable="false" > + <item>0</item> + <item>.5</item> + <item>1</item> + <item>1.5</item> + <item>2</item> + <item>5</item> + <item>10</item> + </string-array> + + <!-- Titles for animator duration scale preference. [CHAR LIMIT=35] --> + <string-array name="animator_duration_scale_entries"> + <item>Animation off</item> + <item>Animation scale .5x</item> + <item>Animation scale 1x</item> + <item>Animation scale 1.5x</item> + <item>Animation scale 2x</item> + <item>Animation scale 5x</item> + <item>Animation scale 10x</item> + </string-array> + + <!-- Values for animator duration scale preference. --> + <string-array name="animator_duration_scale_values" translatable="false" > + <item>0</item> + <item>.5</item> + <item>1</item> + <item>1.5</item> + <item>2</item> + <item>5</item> + <item>10</item> + </string-array> + + <!-- Titles for overlay display devices preference. [CHAR LIMIT=35] --> + <string-array name="overlay_display_devices_entries"> + <item>None</item> + <item>480p</item> + <item>480p (secure)</item> + <item>720p</item> + <item>720p (secure)</item> + <item>1080p</item> + <item>1080p (secure)</item> + <item>4K</item> + <item>4K (secure)</item> + <item>4K (upscaled)</item> + <item>4K (upscaled, secure)</item> + <item>720p, 1080p (dual screen)</item> + </string-array> + + <!-- Values for overlay display devices preference. --> + <string-array name="overlay_display_devices_values" translatable="false" > + <item></item> + <item>720x480/142</item> + <item>720x480/142,secure</item> + <item>1280x720/213</item> + <item>1280x720/213,secure</item> + <item>1920x1080/320</item> + <item>1920x1080/320,secure</item> + <item>3840x2160/320</item> + <item>3840x2160/320,secure</item> + <item>1920x1080/320|3840x2160/640</item> + <item>1920x1080/320|3840x2160/640,secure</item> + <item>1280x720/213;1920x1080/320</item> + </string-array> + + <!-- Titles for OpenGL traces preference. [CHAR LIMIT=35] --> + <string-array name="enable_opengl_traces_entries"> + <item>None</item> + <item>Logcat</item> + <item>Systrace (Graphics)</item> + <item>Call stack on glGetError</item> + </string-array> + + <!-- Values for OpenGL traces preference. --> + <string-array name="enable_opengl_traces_values" translatable="false" > + <item>0</item> + <item>1</item> + <item>systrace</item> + <item>error</item> + </string-array> + + <!-- Titles for non-rectangular clipping preference. [CHAR LIMIT=35] --> + <string-array name="show_non_rect_clip_entries"> + <item>Off</item> + <item>Draw non-rectangular clip region in blue</item> + <item>Highlight tested drawing commands in green</item> + </string-array> + + <!-- Values for non-rectangular clipping preference. --> + <string-array name="show_non_rect_clip_values" translatable="false" > + <item>hide</item> + <item>region</item> + <item>highlight</item> + </string-array> + + <!-- Titles for frame time tracking preference. [CHAR LIMIT=35] --> + <string-array name="track_frame_time_entries"> + <item>Off</item> + <item>On screen as bars</item> + <item>In adb shell dumpsys gfxinfo</item> + </string-array> + + <!-- Values for frame time tracking preference. --> + <string-array name="track_frame_time_values" translatable="false" > + <item>false</item> + <item>visual_bars</item> + <item>true</item> + </string-array> + + <!-- Titles for debug overdraw preference. [CHAR LIMIT=50] --> + <string-array name="debug_hw_overdraw_entries"> + <item>Off</item> + <item>Show overdraw areas</item> + <item>Show areas for Deuteranomaly</item> + </string-array> + + <!-- Values for debug overdraw preference. --> + <string-array name="debug_hw_overdraw_values" translatable="false" > + <item>false</item> + <item>show</item> + <item>show_deuteranomaly</item> + </string-array> + + <!-- Titles for app process limit preference. [CHAR LIMIT=35] --> + <string-array name="app_process_limit_entries"> + <item>Standard limit</item> + <item>No background processes</item> + <item>At most 1 process</item> + <item>At most 2 processes</item> + <item>At most 3 processes</item> + <item>At most 4 processes</item> + </string-array> + + <!-- Values for app process limit preference. --> + <string-array name="app_process_limit_values" translatable="false" > + <item>-1</item> + <item>0</item> + <item>1</item> + <item>2</item> + <item>3</item> + <item>4</item> + </string-array> + + <!-- USB configuration names for Developer Settings. + This can be overridden by devices with additional USB configurations. --> + <string-array name="usb_configuration_titles"> + <item>Charging</item> + <item>MTP (Media Transfer Protocol)</item> + <item>PTP (Picture Transfer Protocol)</item> + <item>RNDIS (USB Ethernet)</item> + <item>Audio Source</item> + <item>MIDI</item> + </string-array> + + <!-- USB configuration values for Developer Settings. + These are lists of USB functions passed to the USB Manager to change USB configuraton. + This can be overridden by devices with additional USB configurations. + Do not translate. --> + <string-array name="usb_configuration_values" translatable="false"> + <!-- Do not translate. --> + <item>none</item> + <!-- Do not translate. --> + <item>mtp</item> + <!-- Do not translate. --> + <item>ptp</item> + <!-- Do not translate. --> + <item>rndis</item> + <!-- Do not translate. --> + <item>audio_source</item> + <!-- Do not translate. --> + <item>midi</item> + </string-array> + + <!-- Possible values for user theme in Display Settings. + Do not translate. --> + <string-array name="night_mode_entries" translatable="false"> + <!-- Do not translate. --> + <item>@string/night_mode_no</item> + <!-- Do not translate. --> + <item>@string/night_mode_yes</item> + <!-- Do not translate. --> + <item>@string/night_mode_auto</item> + </string-array> + + <!-- These values should match up with the MODE_NIGHT constants in UiModeManager. + Do not translate. --> + <string-array name="night_mode_values" translatable="false"> + <!-- Do not translate. --> + <item>1</item> + <!-- Do not translate. --> + <item>2</item> + <!-- Do not translate. --> + <item>0</item> + </string-array> + + <!-- Display color space adjustment modes for developers --> + <string-array name="simulate_color_space_entries" translatable="false"> + <item>@string/daltonizer_mode_disabled</item> + <item>@string/daltonizer_mode_monochromacy</item> + <item>@string/daltonizer_mode_deuteranomaly</item> + <item>@string/daltonizer_mode_protanomaly</item> + <item>@string/daltonizer_mode_tritanomaly</item> + </string-array> + + <!-- Values for display color space adjustment modes for developers --> + <string-array name="simulate_color_space_values" translatable="false"> + <item>-1</item> + <item>0</item> + <item>2</item> + <item>1</item> + <item>3</item> + </string-array> + </resources> diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml index a37196e48891..55bd08a16d8f 100644 --- a/packages/SettingsLib/res/values/strings.xml +++ b/packages/SettingsLib/res/values/strings.xml @@ -351,4 +351,369 @@ <!-- Full package name of OEM preferred device feedback reporter. Leave this blank, overlaid in Settings/TvSettings [DO NOT TRANSLATE] --> <string name="oem_preferred_feedback_reporter" translatable="false" /> + <!-- Development settings --> + <skip/> + <!-- Development Settings. the title for the item to take the user to Development settings. Development settings are settings meant for application developers. --> + <string name="development_settings_title">Developer options</string> + <!-- Development settings enable title. --> + <string name="development_settings_enable">Enable developer options</string> + <!-- Development Settings summary. The summary of the item to take the user to Development settings. Development settings are settings meant for application developers. --> + <string name="development_settings_summary">Set options for app development</string> + <!-- Setting checkbox title for Whether to enable USB debugging support on the phone. --> + <!-- Error message for users that aren't allowed to modify developer options [CHAR LIMIT=none] --> + <string name="development_settings_not_available">Developer options are not available for this user</string> + <!-- Error message for users that aren't allowed to modify VPN settings [CHAR LIMIT=none] --> + <string name="vpn_settings_not_available">VPN settings are not available for this user</string> + <!-- Error message for users that aren't allowed to modify Tethering settings [CHAR LIMIT=none] --> + <string name="tethering_settings_not_available">Tethering settings are not available for this user</string> + <!-- Error message for users that aren't allowed to modify Access Point Names settings [CHAR LIMIT=none] --> + <string name="apn_settings_not_available">Access Point Name settings are not available for this user</string> + <string name="enable_adb">USB debugging</string> + <!-- Setting checkbox summary for Whether to enable USB debugging support on the phone --> + <string name="enable_adb_summary">Debug mode when USB is connected</string> + <!-- Setting title to revoke secure USB debugging authorizations --> + <string name="clear_adb_keys">Revoke USB debugging authorizations</string> + <!-- [CHAR LIMIT=NONE] Setting checkbox title for Whether to include bug report item in power menu. --> + <string name="bugreport_in_power">Bug report shortcut</string> + <!-- [CHAR LIMIT=NONE] Setting checkbox summary for Whether to include bug report item in power --> + <string name="bugreport_in_power_summary">Show a button in the power menu for taking a bug report</string> + <!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source --> + <string name="keep_screen_on">Stay awake</string> + <!-- setting Checkbox summary whether to keep the screen on when plugged in --> + <string name="keep_screen_on_summary">Screen will never sleep while charging</string> + <!-- Setting Checkbox title whether to enable bluetooth HCI snoop log --> + <string name="bt_hci_snoop_log">Enable Bluetooth HCI snoop log</string> + <!-- setting Checkbox summary whether to capture all bluetooth HCI packets in a file --> + <string name="bt_hci_snoop_log_summary">Capture all bluetooth HCI packets in a file</string> + <!-- setting Checkbox title whether to enable OEM unlock [CHAR_LIMIT=35] --> + <string name="oem_unlock_enable">OEM unlocking</string> + <!-- setting Checkbox summary whether to enable OEM unlock [CHAR_LIMIT=50] --> + <string name="oem_unlock_enable_summary">Allow the bootloader to be unlocked</string> + <!-- Confirmation dialog title to ensure user wishes to enable OEM unlock and disable theft protection features --> + <string name="confirm_enable_oem_unlock_title">Allow OEM unlocking?</string> + <!-- Warning dialog message to confirm user wishes to enable OEM unlock and disable theft protection features --> + <string name="confirm_enable_oem_unlock_text">WARNING: Device protection features will not work on this device while this setting is turned on.</string> + + <!-- UI debug setting: select current app to mock location [CHAR LIMIT=50] --> + <string name="mock_location_app">Select mock location app</string> + <!-- UI debug setting: no mock location app has been set [CHAR LIMIT=50] --> + <string name="mock_location_app_not_set">No mock location app set</string> + <!-- UI debug setting: mock location app has been set [CHAR LIMIT=50] --> + <string name="mock_location_app_set">Mock location app: <xliff:g id="app_name">%1$s</xliff:g></string> + + <!-- Preference category for networking debugging development settings. [CHAR LIMIT=50] --> + <string name="debug_networking_category">Networking</string> + + <!-- Setting Checkbox title whether to show options for wireless display certification --> + <string name="wifi_display_certification">Wireless display certification</string> + <!-- Setting Checkbox title whether to enable WiFi Verbose Logging. [CHAR LIMIT=40] --> + <string name="wifi_verbose_logging">Enable Wi\u2011Fi Verbose Logging</string> + <!-- Setting Checkbox title whether to enable WiFi Aggressive Handover. [CHAR LIMIT=40] --> + <string name="wifi_aggressive_handover">Aggressive Wi\u2011Fi to Cellular handover</string> + <!-- Setting Checkbox title whether to enable WiFi Scanning in the presence of traffic. [CHAR LIMIT=80] --> + <string name="wifi_allow_scan_with_traffic">Always allow Wi\u2011Fi Roam Scans</string> + <!-- Setting Checkbox title whether to enable WiFi Scanning in the presence of traffic. [CHAR LIMIT=80] --> + <string name="legacy_dhcp_client">Use legacy DHCP client</string> + <!-- Setting Checkbox title whether to always keep cellular data active. [CHAR LIMIT=80] --> + <string name="mobile_data_always_on">Cellular data always active</string> + + <!-- setting Checkbox summary whether to show options for wireless display certification --> + <string name="wifi_display_certification_summary">Show options for wireless display certification</string> + <!-- Setting Checkbox summary whether to enable Wifi verbose Logging [CHAR LIMIT=80] --> + <string name="wifi_verbose_logging_summary">Increase Wi\u2011Fi logging level, show per SSID RSSI in Wi\u2011Fi Picker</string> + <!-- Setting Checkbox summary whether to enable Wifi aggressive handover [CHAR LIMIT=130] --> + <string name="wifi_aggressive_handover_summary">When enabled, Wi\u2011Fi will be more aggressive in handing over the data connection to Cellular, when Wi\u2011Fi signal is low</string> + <!-- Setting Checkbox summary whether to always allow WiFi Roam Scans [CHAR LIMIT=130] --> + <string name="wifi_allow_scan_with_traffic_summary">Allow/Disallow Wi\u2011Fi Roam Scans based on the amount of data traffic present at the interface</string> + <!-- UI debug setting: limit size of Android logger buffers --> + <string name="select_logd_size_title">Logger buffer sizes</string> + <!-- UI debug setting: limit size of Android logger buffers [CHAR LIMIT=59] --> + <string name="select_logd_size_dialog_title">Select Logger sizes per log buffer</string> + <!-- UI debug setting: select USB configuration --> + <string name="select_usb_configuration_title">Select USB Configuration</string> + <!-- UI debug setting: limit size of Android logger buffers [CHAR LIMIT=59] --> + <string name="select_usb_configuration_dialog_title">Select USB Configuration</string> + <!-- Setting Checkbox title whether to allow mock locations --> + <string name="allow_mock_location">Allow mock locations</string> + <!-- setting Checkbox summary whether to allow mock locations --> + <string name="allow_mock_location_summary">Allow mock locations</string> + <!-- Setting Checkbox title whether to enable view attribute inspection --> + <string name="debug_view_attributes">Enable view attribute inspection</string> + <!-- Setting Checkbox summary whether to use DHCP client from Lollipop (Android 5.0) [CHAR LIMIT=130] --> + <string name="legacy_dhcp_client_summary">Use the DHCP client from Lollipop instead of the new Android DHCP client.</string> + <string name="mobile_data_always_on_summary">Always keep mobile data active, even when Wi\u2011Fi is active (for fast network switching).</string> + <!-- Title of warning dialog about the implications of enabling USB debugging --> + <string name="adb_warning_title">Allow USB debugging?</string> + <!-- Warning text to user about the implications of enabling USB debugging --> + <string name="adb_warning_message">USB debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data.</string> + <!-- Message of dialog confirming that user wants to revoke access to adb from all computers they have authorized --> + <string name="adb_keys_warning_message">Revoke access to USB debugging from all computers you\u2019ve previously authorized?</string> + <!-- Title of warning dialog about the implications of enabling developer settings --> + <string name="dev_settings_warning_title">Allow development settings?</string> + <!-- Warning text to user about the implications of enabling USB debugging --> + <string name="dev_settings_warning_message">These settings are intended for development use only. They can cause your device and the applications on it to break or misbehave.</string> + <!-- Title of checkbox setting to perform package verification on apps installed over USB/ADT/ADB [CHAR LIMIT=32] --> + <string name="verify_apps_over_usb_title">Verify apps over USB</string> + <!-- Summary of checkbox setting to perform package verification on apps installed over USB/ADT/ADB [CHAR LIMIT=NONE] --> + <string name="verify_apps_over_usb_summary">Check apps installed via ADB/ADT for harmful behavior.</string> + + <!-- Title of checkbox setting that enables the terminal app. [CHAR LIMIT=32] --> + <string name="enable_terminal_title">Local terminal</string> + <!-- Summary of checkbox setting that enables the terminal app. [CHAR LIMIT=64] --> + <string name="enable_terminal_summary">Enable terminal app that offers local shell access</string> + + <!-- HDCP checking title, used for debug purposes only. [CHAR LIMIT=25] --> + <string name="hdcp_checking_title">HDCP checking</string> + <!-- HDCP checking dialog title, used for debug purposes only. [CHAR LIMIT=25] --> + <string name="hdcp_checking_dialog_title">Set HDCP checking behavior</string> + + <!-- Preference category for app debugging development settings. [CHAR LIMIT=50] --> + <string name="debug_debugging_category">Debugging</string> + + <!-- UI debug setting: select current app to debug [CHAR LIMIT=50] --> + <string name="debug_app">Select debug app</string> + <!-- UI debug setting: no debug app has been set [CHAR LIMIT=50] --> + <string name="debug_app_not_set">No debug application set</string> + <!-- UI debug setting: debug app has been set [CHAR LIMIT=50] --> + <string name="debug_app_set">Debugging application: <xliff:g id="app_name">%1$s</xliff:g></string> + + <!-- UI debug setting: title for app picker dialog [CHAR LIMIT=50] --> + <string name="select_application">Select application</string> + <!-- UI debug setting: label for app picker to select no applicatiojn [CHAR LIMIT=50] --> + <string name="no_application">Nothing</string> + + <!-- UI debug setting: wait for debugger to attach to debugging process? [CHAR LIMIT=50] --> + <string name="wait_for_debugger">Wait for debugger</string> + <!-- UI debug setting: wait for debugger to attach to debugging process summary [CHAR LIMIT=500] --> + <string name="wait_for_debugger_summary">Debugged application waits for debugger to + attach before executing</string> + + <!-- Preference category for input debugging development settings. [CHAR LIMIT=25] --> + <string name="debug_input_category">Input</string> + + <!-- Preference category for drawing debugging development settings. [CHAR LIMIT=25] --> + <string name="debug_drawing_category">Drawing</string> + + <!-- Preference category for hardware accelerated drawing debugging development settings. [CHAR LIMIT=50] --> + <string name="debug_hw_drawing_category">Hardware accelerated rendering</string> + + <!-- Preference category for media development settings. [CHAR LIMIT=50] --> + <string name="media_category">Media</string> + + <!-- Preference category for monitoring debugging development settings. [CHAR LIMIT=25] --> + <string name="debug_monitoring_category">Monitoring</string> + + <!-- UI debug setting: always enable strict mode? [CHAR LIMIT=25] --> + <string name="strict_mode">Strict mode enabled</string> + <!-- UI debug setting: show strict mode summary [CHAR LIMIT=50] --> + <string name="strict_mode_summary">Flash screen when apps do long operations + on main thread</string> + + <!-- UI debug setting: show pointer location? [CHAR LIMIT=25] --> + <string name="pointer_location">Pointer location</string> + <!-- UI debug setting: show pointer location summary [CHAR LIMIT=50] --> + <string name="pointer_location_summary">Screen overlay showing current touch data</string> + + <!-- UI debug setting: show touches? [CHAR LIMIT=25] --> + <string name="show_touches">Show touches</string> + <!-- UI debug setting: show touches location summary [CHAR LIMIT=50] --> + <string name="show_touches_summary">Show visual feedback for touches</string> + + <!-- UI debug setting: show where surface updates happen? [CHAR LIMIT=25] --> + <string name="show_screen_updates">Show surface updates</string> + <!-- UI debug setting: show surface updates summary [CHAR LIMIT=50] --> + <string name="show_screen_updates_summary">Flash entire window surfaces when they update</string> + + <!-- UI debug setting: show where window updates happen with GPU rendering? [CHAR LIMIT=25] --> + <string name="show_hw_screen_updates">Show GPU view updates</string> + <!-- UI debug setting: show GPU rendering screen updates summary [CHAR LIMIT=50] --> + <string name="show_hw_screen_updates_summary">Flash views inside windows when drawn with the GPU</string> + + <!-- UI debug setting: show when hardware layers get updated [CHAR LIMIT=25] --> + <string name="show_hw_layers_updates">Show hardware layers updates</string> + <!-- UI debug setting: show hardware layers updates summary [CHAR LIMIT=50] --> + <string name="show_hw_layers_updates_summary">Flash hardware layers green when they update</string> + + <!-- UI debug setting: show the amount of overdraw in apps using the GPU [CHAR LIMIT=25] --> + <string name="debug_hw_overdraw">Debug GPU overdraw</string> + + <!-- UI debug setting: disable use of overlays? [CHAR LIMIT=25] --> + <string name="disable_overlays">Disable HW overlays</string> + <!-- UI debug setting: disable use of overlays summary [CHAR LIMIT=50] --> + <string name="disable_overlays_summary">Always use GPU for screen compositing</string> + + <!-- UI debug setting: simulate color space anomalies. [CHAR LIMIT=25] --> + <string name="simulate_color_space">Simulate color space</string> + + <!-- UI debug setting: enable various types of OpenGL traces [CHAR LIMIT=25] --> + <string name="enable_opengl_traces_title">Enable OpenGL traces</string> + + <!-- UI debug setting: disable USB audio routing title [CHAR LIMIT=32] --> + <string name="usb_audio_disable_routing">Disable USB audio routing</string> + <!-- UI debug setting: disable USB audio routing summary [CHAR LIMIT=50] --> + <string name="usb_audio_disable_routing_summary">Disable automatic routing to USB audio peripherals</string> + + <!-- UI debug setting: show layout bounds information [CHAR LIMIT=25] --> + <string name="debug_layout">Show layout bounds</string> + <!-- UI debug setting: show layout bounds information summary [CHAR LIMIT=50] --> + <string name="debug_layout_summary">Show clip bounds, margins, etc.</string> + + <!-- UI debug setting: force right to left layout [CHAR LIMIT=37] --> + <string name="force_rtl_layout_all_locales">Force RTL layout direction</string> + <!-- UI debug setting: force right to left layout summary [CHAR LIMIT=100] --> + <string name="force_rtl_layout_all_locales_summary">Force screen layout direction to RTL for all locales</string> + + <!-- UI debug setting: show how CPU is being used? [CHAR LIMIT=25] --> + <string name="show_cpu_usage">Show CPU usage</string> + <!-- UI debug setting: show cpu usage summary [CHAR LIMIT=50] --> + <string name="show_cpu_usage_summary">Screen overlay showing current CPU usage</string> + + <!-- UI debug setting: force hardware acceleration to render apps [CHAR LIMIT=25] --> + <string name="force_hw_ui">Force GPU rendering</string> + <!-- UI debug setting: force hardware acceleration summary [CHAR LIMIT=50] --> + <string name="force_hw_ui_summary">Force use of GPU for 2d drawing</string> + + <!-- UI debug setting: force anti-aliasing to render apps [CHAR LIMIT=25] --> + <string name="force_msaa">Force 4x MSAA</string> + <!-- UI debug setting: force anti-aliasing summary [CHAR LIMIT=50] --> + <string name="force_msaa_summary">Enable 4x MSAA in OpenGL ES 2.0 apps</string> + + <!-- UI debug setting: show when non-rectangular clip operations are used [CHAR LIMIT=100] --> + <string name="show_non_rect_clip">Debug non-rectangular clip operations</string> + + <!-- UI debug setting: profile time taken by hardware acceleration to render apps [CHAR LIMIT=25] --> + <string name="track_frame_time">Profile GPU rendering</string> + + <!-- UI debug setting: scaling factor for window animations [CHAR LIMIT=25] --> + <string name="window_animation_scale_title">Window animation scale</string> + + <!-- UI debug setting: scaling factor for transition animations [CHAR LIMIT=25] --> + <string name="transition_animation_scale_title">Transition animation scale</string> + + <!-- UI debug setting: scaling factor for all Animator-based animations [CHAR LIMIT=25] --> + <string name="animator_duration_scale_title">Animator duration scale</string> + + <!-- UI debug setting: simulate secondary display devices using overlays [CHAR LIMIT=25] --> + <string name="overlay_display_devices_title">Simulate secondary displays</string> + + <!-- Preference category for application debugging development settings. [CHAR LIMIT=25] --> + <string name="debug_applications_category">Apps</string> + + <!-- UI debug setting: immediately destroy activities? [CHAR LIMIT=25] --> + <string name="immediately_destroy_activities">Don\u2019t keep activities</string> + <!-- UI debug setting: immediately destroy activities summary [CHAR LIMIT=50] --> + <string name="immediately_destroy_activities_summary">Destroy every activity as soon as + the user leaves it</string> + + <!-- UI debug setting: limit number of running background processes [CHAR LIMIT=25] --> + <string name="app_process_limit_title">Background process limit</string> + + <!-- UI debug setting: show all ANRs? [CHAR LIMIT=25] --> + <string name="show_all_anrs">Show all ANRs</string> + <!-- UI debug setting: show all ANRs summary [CHAR LIMIT=50] --> + <string name="show_all_anrs_summary">Show App Not Responding dialog + for background apps</string> + + <!-- UI debug setting: force allow apps on external storage [CHAR LIMIT=50] --> + <string name="force_allow_on_external">Force allow apps on external</string> + <!-- UI debug setting: force allow on external summary [CHAR LIMIT=150] --> + <string name="force_allow_on_external_summary">Makes any app elligible to be written to external storage, regardless of manifest values</string> + + <!-- UI debug setting: force all activites to be resizable for multiwindow [CHAR LIMIT=50] --> + <string name="force_resizable_activities">Force activities to be resizable</string> + <!-- UI debug setting: force allow on external summary [CHAR LIMIT=150] --> + <string name="force_resizable_activities_summary">Makes all activities resizable for multi-window, regardless of manifest values.</string> + + <!-- Local (desktop) backup password menu title [CHAR LIMIT=25] --> + <string name="local_backup_password_title">Desktop backup password</string> + <!-- Summary text of the "local backup password" setting when the user has not supplied a password --> + <string name="local_backup_password_summary_none">Desktop full backups aren\u2019t currently protected</string> + <!-- Summary text of the "local backup password" setting when the user has already supplied a password --> + <string name="local_backup_password_summary_change">Touch to change or remove the password for desktop full backups</string> + + <!-- Toast message shown when the user successfully sets a new local backup password [CHAR LIMIT=80] --> + <string name="local_backup_password_toast_success">New backup password set</string> + <!-- Toast message shown when setting a new local backup password fails due to the user not correctly typing the password again for confirmation [CHAR LIMIT=80] --> + <string name="local_backup_password_toast_confirmation_mismatch">New password and confirmation don\u2019t match</string> + <!-- Toast message shown when setting a new local backup password fails due to the user not supplying the correct existing password. The phrasing here is deliberately quite general. [CHAR LIMIT=80] --> + <string name="local_backup_password_toast_validation_failure">Failure setting backup password</string> + + <!-- Name of each color mode for the display. [CHAR LIMIT=40] --> + <string-array name="color_mode_names"> + <item>Vibrant (default)</item> + <item>Natural</item> + <item>Standard</item> + </string-array> + + <!-- Description of each color mode for the display. [CHAR LIMIT=NONE] --> + <string-array name="color_mode_descriptions"> + <item>Enhanced colors</item> + <item>Natural colors as seen by the eye</item> + <item>Colors optimized for digital content</item> + </string-array> + + <!-- Settings item title for inactive apps [CHAR LIMIT=35] --> + <string name="inactive_apps_title">Inactive apps</string> + <!-- Settings item summary for inactive app [CHAR LIMIT=100] --> + <string name="inactive_app_inactive_summary">Inactive. Touch to toggle.</string> + <!-- Settings item summary for active app [CHAR LIMIT=100] --> + <string name="inactive_app_active_summary">Active. Touch to toggle.</string> + + <!-- Services settings screen, setting option name for the user to go to the screen to view running services --> + <string name="runningservices_settings_title">Running services</string> + <!-- Services settings screen, setting option summary for the user to go to the screen to view running services --> + <string name="runningservices_settings_summary">View and control currently running services</string> + + <!-- Sound & display settings screen, setting option name to change the user interface theme [CHAR LIMIT=30] --> + <string name="night_mode_title">Night mode</string> + <!-- Sound & display settings screen, setting option summary to change the user interface theme [CHAR LIMIT=100] --> + <string name="night_mode_summary">%s</string> + <!-- Sound & display settings screen, theme setting value to prefer a light-colored user interface [CHAR LIMIT=30] --> + <string name="night_mode_no">Disabled</string> + <!-- Sound & display settings screen, theme setting value to prefer a dark-colored user interface [CHAR LIMIT=30] --> + <string name="night_mode_yes">Always on</string> + <!-- Sound & display settings screen, theme setting value to automatically switch between a light- or dark-colored user interface [CHAR LIMIT=30] --> + <string name="night_mode_auto">Automatic</string> + + <!-- Developer settings screen, convert userdata to file encryption option name --> + <string name="convert_to_file_encryption">Convert to file encryption</string> + <!-- Developer settings screen, convert userdata to file encryption summary when option is available --> + <string name="convert_to_file_encryption_enabled">Convert\u2026</string> + <!-- Developer settings screen, convert userdata to file encryption summary when option is already done --> + <string name="convert_to_file_encryption_done">Already file encrypted</string> + <!-- Title used on dialog with final prompt for converting to file encryption --> + <string name="title_convert_fbe">Converting to file based encryption</string> + <!-- Warning displayed on dialog with final prompt for converting to file encryption --> + <string name="convert_to_fbe_warning"> + Convert data partition to file based encryption.\n + !!Warning!! This will erase all your data.\n + This feature is alpha, and may not work correctly.\n + Press \'Wipe and convert\u2026\' to continue.</string> + <!-- Button on dialog that triggers convertion to file encryption --> + <string name="button_convert_fbe">Wipe and convert\u2026</string> + + <!-- Name of feature to change color setting for the display [CHAR LIMIT=60] --> + <string name="picture_color_mode">Picture color mode</string> + + <!-- Description of feature to change color setting for the display [CHAR LIMIT=NONE] --> + <string name="picture_color_mode_desc">Use sRGB</string> + + <!-- Label for disabling color space adjustment [CHAR LIMIT=45] --> + <string name="daltonizer_mode_disabled">Disabled</string> + <!-- Label for converting display colors to grayscale, which simulates monochromacy (complete color blindness). [CHAR LIMIT=45] --> + <string name="daltonizer_mode_monochromacy">Monochromacy</string> + <!-- Label for deuteranomaly (red-green color blindness) [CHAR LIMIT=45] --> + <string name="daltonizer_mode_deuteranomaly">Deuteranomaly (red-green)</string> + <!-- Label for protanomaly (red-green color blindness) [CHAR LIMIT=45] --> + <string name="daltonizer_mode_protanomaly">Protanomaly (red-green)</string> + <!-- Label for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=45] --> + <string name="daltonizer_mode_tritanomaly">Tritanomaly (blue-yellow)</string> + + <!-- Title for the accessibility preference to configure display color space correction. [CHAR LIMIT=NONE] --> + <string name="accessibility_display_daltonizer_preference_title">Color correction</string> + <!-- Subtitle for the accessibility preference to configure display color space correction. [CHAR LIMIT=NONE] --> + <string name="accessibility_display_daltonizer_preference_subtitle">This feature is experimental and may affect performance.</string> + <!-- Summary shown for color space correction preference when its value is overridden by another preference [CHAR LIMIT=35] --> + <string name="daltonizer_type_overridden">Overridden by <xliff:g id="title" example="Simulate color space">%1$s</xliff:g></string> + </resources> diff --git a/packages/Shell/res/values/strings.xml b/packages/Shell/res/values/strings.xml index cff36f73f74d..090b17118145 100644 --- a/packages/Shell/res/values/strings.xml +++ b/packages/Shell/res/values/strings.xml @@ -17,8 +17,8 @@ <resources> <string name="app_label">Shell</string> - <!-- Title of notification indicating a bugreport process is in progress. [CHAR LIMIT=50] --> - <string name="bugreport_in_progress_title">Bug report in progress</string> + <!-- Title of notification indicating a bugreport is being generated. [CHAR LIMIT=50] --> + <string name="bugreport_in_progress_title">Bug report is being generated</string> <!-- Title of notification indicating a bugreport has been successfully captured. [CHAR LIMIT=50] --> <string name="bugreport_finished_title">Bug report captured</string> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index bfd8af9d2a59..5618e9bf3c4d 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -21,7 +21,6 @@ <drawable name="ticker_background_color">#ff1d1d1d</drawable> <drawable name="system_bar_background">@color/system_bar_background_opaque</drawable> <color name="system_bar_background_opaque">#ff000000</color> - <color name="system_bar_background_semi_transparent">#66000000</color> <!-- 40% black --> <color name="system_bar_background_transparent">#00000000</color> <color name="notification_panel_solid_background">#ff000000</color> <drawable name="status_bar_notification_row_background_color">#ff090909</drawable> diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 902db26d21fa..a0052cec986e 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -175,7 +175,7 @@ <integer name="recents_animate_task_view_remove_duration">250</integer> <!-- The animation duration for scrolling the stack to a particular item. --> - <integer name="recents_animate_task_stack_scroll_duration">225</integer> + <integer name="recents_animate_task_stack_scroll_duration">200</integer> <!-- The animation duration for entering and exiting the history. --> <integer name="recents_history_transition_duration">250</integer> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index d6a361c2be71..002b9f504e52 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1171,13 +1171,23 @@ <!-- Toggles fullscreen screenshots. DO NOT TRANSLATE --> <string name="overview_fullscreen_thumbnails">Enable fullscreen screenshots</string> <!-- Description for the toggle for fullscreen screenshots. DO NOT TRANSLATE --> - <string name="overview_fullscreen_thumbnails_desc">Enable fullscreen screenshots in Overview</string> + <string name="overview_fullscreen_thumbnails_desc">Enable fullscreen screenshots in Overview. Restart required.</string> + + <!-- Toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE --> + <string name="overview_nav_bar_gesture">Enable navigation bar gesture</string> + <!-- Description for the toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE --> + <string name="overview_nav_bar_gesture_desc">Enables the gesture to enter Overview by swiping up on the Nav bar</string> <!-- Toggle to show the history view in Overview. DO NOT TRANSLATE --> <string name="overview_show_history">Show History</string> <!-- Description for the toggle to show the history view in Overview. DO NOT TRANSLATE --> <string name="overview_show_history_desc">Enables the history view to see more recent tasks</string> + <!-- Toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE --> + <string name="overview_initial_state_paging">Initialize to paging</string> + <!-- Description for the toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE --> + <string name="overview_initial_state_paging_desc">Determines whether Overview will initially be in a stacked or paged state</string> + <!-- Category in the System UI Tuner settings, where new/experimental settings are --> <string name="experimental">Experimental</string> diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml index f398af3d04c9..8dcf8a7bc60f 100644 --- a/packages/SystemUI/res/xml/tuner_prefs.xml +++ b/packages/SystemUI/res/xml/tuner_prefs.xml @@ -93,11 +93,21 @@ android:summary="@string/overview_page_on_toggle_desc" /> <com.android.systemui.tuner.TunerSwitch + android:key="overview_initial_state_paging" + android:title="@string/overview_initial_state_paging" + android:summary="@string/overview_initial_state_paging_desc" /> + + <com.android.systemui.tuner.TunerSwitch android:key="overview_fast_toggle" android:title="@string/overview_fast_toggle_via_button" android:summary="@string/overview_fast_toggle_via_button_desc" /> <com.android.systemui.tuner.TunerSwitch + android:key="overview_nav_bar_gesture" + android:title="@string/overview_nav_bar_gesture" + android:summary="@string/overview_nav_bar_gesture_desc" /> + + <com.android.systemui.tuner.TunerSwitch android:key="overview_fullscreen_thumbnails" android:title="@string/overview_fullscreen_thumbnails" android:summary="@string/overview_fullscreen_thumbnails_desc" /> diff --git a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java index 4cb8a3cdad4a..7f6cda036515 100644 --- a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java @@ -32,7 +32,7 @@ public interface RecentsComponent { /** * Docks the top-most task and opens recents. */ - void dockTopTask(boolean draggingInRecents, Rect initialBounds); + void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds); /** * Called during a drag-from-navbar-in gesture. diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index c98ecb591fce..b81c23a6e0a7 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -365,8 +365,8 @@ public class Recents extends SystemUI } @Override - public void dockTopTask(boolean draggingInRecents, Rect initialBounds) { - mImpl.dockTopTask(draggingInRecents, initialBounds); + public void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds) { + mImpl.dockTopTask(draggingInRecents, stackCreateMode,initialBounds); if (draggingInRecents) { mDraggingInRecentsCurrentUser = sSystemServicesProxy.getCurrentUser(); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 063bb3ecb50b..384b86f4cc8b 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -425,10 +425,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent()); } - if (!launchState.launchedHasConfigurationChanged) { - mRecentsView.disableLayersForOneFrame(); - } - // Notify that recents is now visible SystemServicesProxy ssp = Recents.getSystemServices(); EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true)); diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java index 43db6660fab3..e0bd59b2b9d7 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java @@ -82,7 +82,7 @@ public class RecentsActivityLaunchState { if (launchedFromHome) { return numTasks - 1; } else { - if (flags.isFastToggleRecentsEnabled()) { + if (flags.isFastToggleRecentsEnabled() || !flags.isInitialStatePaging()) { return numTasks - 1; } else { return numTasks - 2; diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java index cdfad18311ad..53c10b7a1cc3 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java @@ -115,8 +115,8 @@ public class RecentsConfiguration { // Recompute some values based on the given state, since we can not rely on the resource // system to get certain values. boolean isLandscape = windowRect.width() > windowRect.height(); - hasTransposedNavBar = isLandscape && isLargeScreen && !isXLargeScreen; - hasTransposedSearchBar = isLandscape && isLargeScreen && !isXLargeScreen; + hasTransposedNavBar = isLandscape && !isXLargeScreen; + hasTransposedSearchBar = isLandscape && !isXLargeScreen; } /** diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java index e8b88165721c..d778886721e7 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java @@ -30,6 +30,7 @@ public class RecentsDebugFlags implements TunerService.Tunable { private static final String KEY_PAGE_ON_TOGGLE = "overview_page_on_toggle"; private static final String KEY_FULLSCREEN_THUMBNAILS = "overview_fullscreen_thumbnails"; private static final String KEY_SHOW_HISTORY = "overview_show_history"; + private static final String KEY_INITIAL_STATE_PAGING = "overview_initial_state_paging"; public static class Static { // Enables debug drawing for the transition thumbnail @@ -54,6 +55,7 @@ public class RecentsDebugFlags implements TunerService.Tunable { private boolean mPageOnToggle; private boolean mUseFullscreenThumbnails; private boolean mShowHistory; + private boolean mInitialStatePaging; /** * We read the prefs once when we start the activity, then update them as the tuner changes @@ -63,7 +65,7 @@ public class RecentsDebugFlags implements TunerService.Tunable { // Register all our flags, this will also call onTuningChanged() for each key, which will // initialize the current state of each flag TunerService.get(context).addTunable(this, KEY_FAST_TOGGLE, KEY_PAGE_ON_TOGGLE, - KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY); + KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY, KEY_INITIAL_STATE_PAGING); } /** @@ -94,6 +96,13 @@ public class RecentsDebugFlags implements TunerService.Tunable { return mShowHistory; } + /** + * @return whether the initial stack state is paging. + */ + public boolean isInitialStatePaging() { + return mInitialStatePaging; + } + @Override public void onTuningChanged(String key, String newValue) { switch (key) { @@ -113,6 +122,10 @@ public class RecentsDebugFlags implements TunerService.Tunable { mShowHistory = (newValue != null) && (Integer.parseInt(newValue) != 0); break; + case KEY_INITIAL_STATE_PAGING: + mInitialStatePaging = (newValue != null) && + (Integer.parseInt(newValue) != 0); + break; } EventBus.getDefault().send(new DebugFlagsChangedEvent()); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java index 3efb0cc846ae..2a4017aae6ad 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java @@ -539,12 +539,11 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements showRelativeAffiliatedTask(false); } - public void dockTopTask(boolean draggingInRecents, Rect initialBounds) { + public void dockTopTask(boolean draggingInRecents, int stackCreateMode, Rect initialBounds) { SystemServicesProxy ssp = Recents.getSystemServices(); ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask(); if (topTask != null && !SystemServicesProxy.isHomeStack(topTask.stackId)) { - ssp.moveTaskToDockedStack(topTask.id, - ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, initialBounds); + ssp.moveTaskToDockedStack(topTask.id, stackCreateMode, initialBounds); showRecents(false /* triggeredFromAltTab */, draggingInRecents, false /* animate */, true /* reloadTasks*/); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index 2b20c07d8be0..5d17e2c54201 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -115,7 +115,6 @@ public class SystemServicesProxy { /** Private constructor */ public SystemServicesProxy(Context context) { - RecentsDebugFlags flags = Recents.getDebugFlags(); mAccm = AccessibilityManager.getInstance(context); mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); mIam = ActivityManagerNative.getDefault(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java index 530cd2d12db9..7a9839365498 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java +++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java @@ -137,7 +137,7 @@ class FilteredTaskList { /** Returns the index of this task in the list of filtered tasks */ int indexOf(Task t) { - if (mTaskIndices.containsKey(t.key)) { + if (t != null && mTaskIndices.containsKey(t.key)) { return mTaskIndices.get(t.key); } return -1; @@ -199,8 +199,8 @@ public class TaskStack { /** Task stack callbacks */ public interface TaskStackCallbacks { /* Notifies when a task has been removed from the stack */ - void onStackTaskRemoved(TaskStack stack, Task removedTask, int removedTaskIndex, - boolean wasFrontMostTask, Task newFrontMostTask); + void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask, + Task newFrontMostTask); /* Notifies when a task has been removed from the history */ void onHistoryTaskRemoved(TaskStack stack, Task removedTask); @@ -393,8 +393,7 @@ public class TaskStack { } if (mCb != null) { // Notify that a task has been removed - mCb.onStackTaskRemoved(this, t, removedTaskIndex, wasFrontMostTask, - newFrontMostTask); + mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask); } } else if (mHistoryTaskList.contains(t)) { removeTaskImpl(mHistoryTaskList, t); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index dac705dd3015..a0a1baccfe64 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -16,6 +16,8 @@ package com.android.systemui.recents.views; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; @@ -27,6 +29,8 @@ import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; +import android.view.ViewConfiguration; +import android.view.ViewPropertyAnimator; import android.view.WindowInsets; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; @@ -55,6 +59,8 @@ import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent; import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.model.TaskStack; +import com.android.systemui.stackdivider.WindowManagerProxy; +import com.android.systemui.statusbar.FlingAnimationUtils; import java.util.ArrayList; import java.util.List; @@ -94,8 +100,10 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV Rect mSystemInsets = new Rect(); + final FlingAnimationUtils mFlingAnimationUtils; + public RecentsView(Context context) { - super(context); + this(context, null); } public RecentsView(Context context, AttributeSet attrs) { @@ -118,6 +126,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV com.android.internal.R.interpolator.fast_out_linear_in); mHistoryTransitionDuration = res.getInteger(R.integer.recents_history_transition_duration); mTouchHandler = new RecentsViewTouchHandler(this); + mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f); LayoutInflater inflater = LayoutInflater.from(context); mHistoryButton = inflater.inflate(R.layout.recents_history_button, this, false); @@ -445,12 +454,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV return super.verifyDrawable(who); } - public void disableLayersForOneFrame() { - if (mTaskStackView != null) { - mTaskStackView.disableLayersForOneFrame(); - } - } - /**** TaskStackView.TaskStackCallbacks Implementation ****/ @Override @@ -517,7 +520,22 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV } public final void onBusEvent(DraggingInRecentsEndedEvent event) { - animate().translationY(0f); + ViewPropertyAnimator animator = animate(); + if (event.velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond()) { + animator.translationY(getHeight()); + animator.withEndAction(new Runnable() { + @Override + public void run() { + WindowManagerProxy.getInstance().maximizeDockedStack(); + } + }); + mFlingAnimationUtils.apply(animator, getTranslationY(), getHeight(), event.velocity); + } else { + animator.translationY(0f); + animator.setListener(null); + mFlingAnimationUtils.apply(animator, getTranslationY(), 0, event.velocity); + } + animator.start(); } public final void onBusEvent(ShowHistoryEvent event) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java index 5c906a62dc90..7d5daaed8ce4 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java @@ -118,18 +118,21 @@ public class TaskStackLayoutAlgorithm { */ public static class StackState { - public static final StackState FREEFORM_ONLY = new StackState(1f); - public static final StackState STACK_ONLY = new StackState(0f); - public static final StackState SPLIT = new StackState(0.5f); + public static final StackState FREEFORM_ONLY = new StackState(1f, 0); + public static final StackState STACK_ONLY = new StackState(0f, 0); + public static final StackState SPLIT = new StackState(0.5f, 255); public final float freeformHeightPct; + public final int freeformBackgroundAlpha; /** * @param freeformHeightPct the percentage of the stack height (not including paddings) to * allocate to the freeform workspace + * @param freeformBackgroundAlpha the background alpha for the freeform workspace */ - StackState(float freeformHeightPct) { + StackState(float freeformHeightPct, int freeformBackgroundAlpha) { this.freeformHeightPct = freeformHeightPct; + this.freeformBackgroundAlpha = freeformBackgroundAlpha; } /** @@ -210,7 +213,7 @@ public class TaskStackLayoutAlgorithm { Context mContext; private TaskStackView mStackView; - private Interpolator mFastOutSlowInInterpolator; + private Interpolator mLinearOutSlowInInterpolator; private StackState mState = StackState.SPLIT; // The task bounds (untransformed) for layout. This rect is anchored at mTaskRoot. @@ -278,7 +281,6 @@ public class TaskStackLayoutAlgorithm { FreeformWorkspaceLayoutAlgorithm mFreeformLayoutAlgorithm; public TaskStackLayoutAlgorithm(Context context, TaskStackView stackView) { - SystemServicesProxy ssp = Recents.getSystemServices(); Resources res = context.getResources(); mStackView = stackView; @@ -293,8 +295,8 @@ public class TaskStackLayoutAlgorithm { mMaxTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_max); mContext = context; mFreeformLayoutAlgorithm = new FreeformWorkspaceLayoutAlgorithm(); - mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, - com.android.internal.R.interpolator.fast_out_slow_in); + mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, + com.android.internal.R.interpolator.linear_out_slow_in); } /** @@ -309,9 +311,6 @@ public class TaskStackLayoutAlgorithm { */ public void setSystemInsets(Rect systemInsets) { mSystemInsets.set(systemInsets); - if (DEBUG) { - Log.d(TAG, "setSystemInsets: " + systemInsets); - } } /** @@ -343,6 +342,7 @@ public class TaskStackLayoutAlgorithm { // The freeform height is the visible height (not including system insets) - padding above // freeform and below stack - gap between the freeform and stack + mState = state; mStackTopOffset = mFocusedPeekHeight + heightPadding; mStackBottomOffset = mSystemInsets.bottom + heightPadding; state.computeRects(mFreeformRect, mStackRect, taskStackBounds, widthPadding, heightPadding, @@ -486,8 +486,9 @@ public class TaskStackLayoutAlgorithm { if (Float.compare(newState, getFocusState()) != 0) { mFocusStateAnimator = ObjectAnimator.ofFloat(this, FOCUS_STATE, getFocusState(), newState); - mFocusStateAnimator.setDuration(200); - mFocusStateAnimator.setInterpolator(mFastOutSlowInInterpolator); + mFocusStateAnimator.setDuration(mContext.getResources().getInteger( + R.integer.recents_animate_task_stack_scroll_duration)); + mFocusStateAnimator.setInterpolator(mLinearOutSlowInInterpolator); mFocusStateAnimator.start(); } } @@ -498,7 +499,8 @@ public class TaskStackLayoutAlgorithm { public float getDefaultFocusState() { RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState(); RecentsDebugFlags debugFlags = Recents.getDebugFlags(); - if (debugFlags.isPageOnToggleEnabled() || launchState.launchedWithAltTab) { + if (launchState.launchedWithAltTab || + (debugFlags.isPageOnToggleEnabled() && debugFlags.isInitialStatePaging())) { return 1f; } return 0f; @@ -514,6 +516,14 @@ public class TaskStackLayoutAlgorithm { } /** + * + * Returns the current stack state. + */ + public StackState getStackState() { + return mState; + } + + /** * Computes the maximum number of visible tasks and thumbnails when the scroll is at the initial * stack scroll. Requires that update() is called first. */ diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index f0d5eabc5f5d..cc5aaae912ee 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -16,6 +16,7 @@ package com.android.systemui.recents.views; +import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.ComponentName; import android.content.Context; @@ -23,8 +24,11 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.util.IntProperty; import android.util.Log; +import android.util.Property; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -90,6 +94,19 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal private static final float SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f; private static final float HIDE_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f; + public static final Property<ColorDrawable, Integer> COLOR_DRAWABLE_ALPHA = + new IntProperty<ColorDrawable>("colorDrawableAlpha") { + @Override + public void setValue(ColorDrawable object, int alpha) { + object.setAlpha(alpha); + } + + @Override + public Integer get(ColorDrawable object) { + return object.getAlpha(); + } + }; + /** The TaskView callbacks */ interface TaskStackViewCallbacks { public void onTaskViewClicked(TaskStackView stackView, TaskView tv, TaskStack stack, Task t, @@ -102,10 +119,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal TaskStackViewTouchHandler mTouchHandler; TaskStackViewCallbacks mCb; ColorDrawable mFreeformWorkspaceBackground; + ObjectAnimator mFreeformWorkspaceBackgroundAnimator; ViewPool<TaskView, Task> mViewPool; ArrayList<TaskViewTransform> mCurrentTaskTransforms = new ArrayList<>(); DozeTrigger mUIDozeTrigger; - int mFocusedTaskIndex = -1; + Task mFocusedTask; // Optimizations int mStackViewsAnimationDuration; boolean mStackViewsDirty = true; @@ -119,7 +137,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal int[] mTmpVisibleRange = new int[2]; Rect mTmpRect = new Rect(); RectF mTmpTaskRect = new RectF(); - TaskViewTransform mTmpTransform = new TaskViewTransform(); TaskViewTransform mTmpStackBackTransform = new TaskViewTransform(); TaskViewTransform mTmpStackFrontTransform = new TaskViewTransform(); HashMap<Task, TaskView> mTmpTaskViewMap = new HashMap<>(); @@ -127,7 +144,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal List<TaskView> mImmutableTaskViews = new ArrayList<>(); List<TaskView> mTmpTaskViews = new ArrayList<>(); LayoutInflater mInflater; - boolean mLayersDisabled; boolean mTouchExplorationEnabled; Interpolator mFastOutSlowInInterpolator; @@ -186,6 +202,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); mFreeformWorkspaceBackground = new ColorDrawable(0x33000000); + mFreeformWorkspaceBackground.setCallback(this); } /** Sets the callbacks */ @@ -462,24 +479,14 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal Log.d(TAG, "picking up from pool: " + task.key); } tv = mViewPool.pickUpViewFromPool(task, task); - if (mLayersDisabled) { - tv.disableLayersForOneFrame(); - } } else { // Reattach it in the right z order - detachViewFromParent(tv); - int insertIndex = -1; int taskIndex = mStack.indexOfStackTask(task); - taskViews = getTaskViews(); - taskViewCount = taskViews.size(); - for (int j = 0; j < taskViewCount; j++) { - Task tvTask = taskViews.get(j).getTask(); - if (taskIndex <= mStack.indexOfStackTask(tvTask)) { - insertIndex = j; - break; - } + int insertIndex = findTaskViewInsertIndex(task, taskIndex); + if (insertIndex != getTaskViews().indexOf(tv)){ + detachViewFromParent(tv); + attachViewToParent(tv, insertIndex, tv.getLayoutParams()); } - attachViewToParent(tv, insertIndex, tv.getLayoutParams()); } // Animate the task into place @@ -500,9 +507,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal if (tv == null) { tv = mViewPool.pickUpViewFromPool(task, task); - if (mLayersDisabled) { - tv.disableLayersForOneFrame(); - } if (mStackViewsAnimationDuration > 0) { // For items in the list, put them in start animating them from the // approriate ends of the list where they are expected to appear @@ -613,7 +617,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.hasFreeformWorkspaceSupport()) { mTmpRect.set(mLayoutAlgorithm.mFreeformRect); - mFreeformWorkspaceBackground.setAlpha(255); mFreeformWorkspaceBackground.setBounds(mTmpRect); } @@ -643,7 +646,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal * @return whether or not the stack will scroll as a part of this focus change */ private boolean setFocusedTask(int taskIndex, boolean scrollToTask, final boolean animated, - final boolean requestViewFocus) { + final boolean requestViewFocus) { // Find the next task to focus int newFocusedTaskIndex = mStack.getStackTaskCount() > 0 ? Math.max(0, Math.min(mStack.getStackTaskCount() - 1, taskIndex)) : -1; @@ -651,16 +654,13 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mStack.getStackTasks().get(newFocusedTaskIndex) : null; // Reset the last focused task state if changed - if (mFocusedTaskIndex != -1) { - Task focusedTask = mStack.getStackTasks().get(mFocusedTaskIndex); - if (focusedTask != newFocusedTask) { - resetFocusedTask(focusedTask); - } + if (mFocusedTask != null) { + resetFocusedTask(mFocusedTask); } boolean willScroll = false; - mFocusedTaskIndex = newFocusedTaskIndex; - if (mFocusedTaskIndex != -1) { + mFocusedTask = newFocusedTask; + if (newFocusedTask != null) { Runnable focusTaskRunnable = new Runnable() { @Override public void run() { @@ -730,13 +730,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal */ public void setRelativeFocusedTask(boolean forward, boolean stackTasksOnly, boolean animated, boolean cancelWindowAnimations) { - int newIndex = -1; - if (mFocusedTaskIndex != -1) { + int newIndex = mStack.indexOfStackTask(mFocusedTask); + if (mFocusedTask != null) { if (stackTasksOnly) { List<Task> tasks = mStack.getStackTasks(); - newIndex = mFocusedTaskIndex; - Task task = tasks.get(mFocusedTaskIndex); - if (task.isFreeformTask()) { + if (mFocusedTask.isFreeformTask()) { // Try and focus the front most stack task TaskView tv = getFrontMostTaskView(stackTasksOnly); if (tv != null) { @@ -744,7 +742,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } } else { // Try the next task if it is a stack task - int tmpNewIndex = mFocusedTaskIndex + (forward ? -1 : 1); + int tmpNewIndex = newIndex + (forward ? -1 : 1); if (0 <= tmpNewIndex && tmpNewIndex < tasks.size()) { Task t = tasks.get(tmpNewIndex); if (!t.isFreeformTask()) { @@ -756,7 +754,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // No restrictions, lets just move to the new task (looping forward/backwards if // necessary) int taskCount = mStack.getStackTaskCount(); - newIndex = (mFocusedTaskIndex + (forward ? -1 : 1) + taskCount) % taskCount; + newIndex = (newIndex + (forward ? -1 : 1) + taskCount) % taskCount; } } else { // We don't have a focused task, so focus the first visible task view @@ -785,17 +783,14 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal tv.setFocusedState(false, false /* animated */, false /* requestViewFocus */); } } - mFocusedTaskIndex = -1; + mFocusedTask = null; } /** * Returns the focused task. */ Task getFocusedTask() { - if (mFocusedTaskIndex != -1) { - return mStack.getStackTasks().get(mFocusedTaskIndex); - } - return null; + return mFocusedTask; } @Override @@ -820,12 +815,13 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal super.onInitializeAccessibilityNodeInfo(info); List<TaskView> taskViews = getTaskViews(); int taskViewCount = taskViews.size(); - if (taskViewCount > 1 && mFocusedTaskIndex != -1) { + if (taskViewCount > 1 && mFocusedTask != null) { info.setScrollable(true); - if (mFocusedTaskIndex > 0) { + int focusedTaskIndex = mStack.indexOfStackTask(mFocusedTask); + if (focusedTaskIndex > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } - if (mFocusedTaskIndex < mStack.getStackTaskCount() - 1) { + if (focusedTaskIndex < mStack.getStackTaskCount() - 1) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } @@ -1028,6 +1024,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mStartEnterAnimationContext = null; } + // Animate in the freeform workspace + animateFreeformWorkspaceBackgroundAlpha( + mLayoutAlgorithm.getStackState().freeformBackgroundAlpha, 150, + mFastOutSlowInInterpolator); + // Set the task focused state without requesting view focus, and leave the focus animations // until after the enter-animation RecentsConfiguration config = Recents.getConfiguration(); @@ -1089,11 +1090,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // requesting view focus in onFirstLayout(), actually request view focus and // animate the focused state if we are alt-tabbing now, after the window enter // animation is completed - if (mFocusedTaskIndex != -1) { + if (mFocusedTask != null) { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); - setFocusedTask(mFocusedTaskIndex, false /* scrollToTask */, - launchState.launchedWithAltTab); + setFocusedTask(mStack.indexOfStackTask(mFocusedTask), + false /* scrollToTask */, launchState.launchedWithAltTab); } } }); @@ -1107,6 +1108,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mStackScroller.stopBoundScrollAnimation(); // Animate all the task views out of view ctx.offscreenTranslationY = mLayoutAlgorithm.mStackRect.bottom; + // Dismiss the freeform workspace background + int taskViewExitToHomeDuration = getResources().getInteger( + R.integer.recents_task_exit_to_home_duration); + animateFreeformWorkspaceBackgroundAlpha(0, taskViewExitToHomeDuration, + mFastOutSlowInInterpolator); List<TaskView> taskViews = getTaskViews(); int taskViewCount = taskViews.size(); @@ -1147,8 +1153,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal @Override protected void dispatchDraw(Canvas canvas) { - mLayersDisabled = false; - // Draw the freeform workspace background SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.hasFreeformWorkspaceSupport()) { @@ -1160,12 +1164,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal super.dispatchDraw(canvas); } - public void disableLayersForOneFrame() { - mLayersDisabled = true; - List<TaskView> taskViews = getTaskViews(); - for (int i = 0; i < taskViews.size(); i++) { - taskViews.get(i).disableLayersForOneFrame(); + @Override + protected boolean verifyDrawable(Drawable who) { + if (who == mFreeformWorkspaceBackground) { + return true; } + return super.verifyDrawable(who); } /** @@ -1183,9 +1187,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal /**** TaskStackCallbacks Implementation ****/ @Override - public void onStackTaskRemoved(TaskStack stack, Task removedTask, int removedTaskIndex, - boolean wasFrontMostTask, Task newFrontMostTask) { - if (mFocusedTaskIndex == removedTaskIndex) { + public void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask, + Task newFrontMostTask) { + if (mFocusedTask == removedTask) { resetFocusedTask(removedTask); } @@ -1314,19 +1318,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal tv.setNoUserInteractionState(); // Find the index where this task should be placed in the stack - int insertIndex = -1; int taskIndex = mStack.indexOfStackTask(task); - if (taskIndex != -1) { - List<TaskView> taskViews = getTaskViews(); - int taskViewCount = taskViews.size(); - for (int i = 0; i < taskViewCount; i++) { - Task tvTask = taskViews.get(i).getTask(); - if (taskIndex < mStack.indexOfStackTask(tvTask)) { - insertIndex = i; - break; - } - } - } + int insertIndex = findTaskViewInsertIndex(task, taskIndex); // Add/attach the view to the hierarchy if (isNewView) { @@ -1344,7 +1337,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal tv.setCallbacks(this); tv.setTouchEnabled(true); tv.setClipViewInStack(true); - if (mFocusedTaskIndex == taskIndex) { + if (mFocusedTask == task) { tv.setFocusedState(true, false /* animated */, false /* requestViewFocus */); } } @@ -1430,10 +1423,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } public final void onBusEvent(DismissFocusedTaskViewEvent event) { - if (mFocusedTaskIndex != -1) { - Task t = mStack.getStackTasks().get(mFocusedTaskIndex); - TaskView tv = getChildViewForTask(t); - tv.dismissTask(); + if (mFocusedTask != null) { + TaskView tv = getChildViewForTask(mFocusedTask); + if (tv != null) { + tv.dismissTask(); + } + resetFocusedTask(mFocusedTask); } } @@ -1575,4 +1570,50 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // Remove the task from the stack mStack.removeTask(task); } + + /** + * Starts an alpha animation on the freeform workspace background. + */ + private void animateFreeformWorkspaceBackgroundAlpha(int targetAlpha, int duration, + Interpolator interpolator) { + if (mFreeformWorkspaceBackground.getAlpha() == targetAlpha) { + return; + } + + Utilities.cancelAnimationWithoutCallbacks(mFreeformWorkspaceBackgroundAnimator); + mFreeformWorkspaceBackgroundAnimator = ObjectAnimator.ofInt(mFreeformWorkspaceBackground, + COLOR_DRAWABLE_ALPHA, mFreeformWorkspaceBackground.getAlpha(), targetAlpha); + mFreeformWorkspaceBackgroundAnimator.setDuration(duration); + mFreeformWorkspaceBackgroundAnimator.setInterpolator(interpolator); + mFreeformWorkspaceBackgroundAnimator.start(); + } + + /** + * Returns the insert index for the task in the current set of task views. If the given task + * is already in the task view list, then this method returns the insert index assuming it + * is first removed at the previous index. + * + * @param task the task we are finding the index for + * @param taskIndex the index of the task in the stack + */ + private int findTaskViewInsertIndex(Task task, int taskIndex) { + if (taskIndex != -1) { + List<TaskView> taskViews = getTaskViews(); + boolean foundTaskView = false; + int taskViewCount = taskViews.size(); + for (int i = 0; i < taskViewCount; i++) { + Task tvTask = taskViews.get(i).getTask(); + if (tvTask == task) { + foundTaskView = true; + } else if (taskIndex < mStack.indexOfStackTask(tvTask)) { + if (foundTaskView) { + return i - 1; + } else { + return i; + } + } + } + } + return -1; + } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java index 4095d2ed21c3..56942a87e0f5 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java @@ -49,7 +49,7 @@ public class TaskStackViewScroller { ObjectAnimator mScrollAnimator; float mFinalAnimatedScroll; - Interpolator mLinearOutSlowInInterpolator; + private Interpolator mLinearOutSlowInInterpolator; public TaskStackViewScroller(Context context, TaskStackLayoutAlgorithm layoutAlgorithm) { mContext = context; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java index 907ed2ffe332..1a6f1294f36e 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java @@ -176,11 +176,11 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { } case MotionEvent.ACTION_POINTER_DOWN: { final int index = ev.getActionIndex(); - mDownX = (int) ev.getX(); - mDownY = (int) ev.getY(); + mActivePointerId = ev.getPointerId(index); + mDownX = (int) ev.getX(index); + mDownY = (int) ev.getY(index); mLastY = mDownY; mDownScrollP = mScroller.getStackScroll(); - mActivePointerId = ev.getPointerId(index); mVelocityTracker.addMovement(ev); break; } @@ -221,6 +221,10 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback { // Select a new active pointer id and reset the motion state final int newPointerIndex = (pointerIndex == 0) ? 1 : 0; mActivePointerId = ev.getPointerId(newPointerIndex); + mDownX = (int) ev.getX(pointerIndex); + mDownY = (int) ev.getY(pointerIndex); + mLastY = mDownY; + mDownScrollP = mScroller.getStackScroll(); } mVelocityTracker.addMovement(ev); break; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 1baa1a31591d..813a1fc2e7ba 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -659,10 +659,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, } } - public void disableLayersForOneFrame() { - mHeaderView.disableLayersForOneFrame(); - } - /**** TaskCallbacks Implementation ****/ /** Binds this task view to the task */ diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java index ec59f31e9ca6..78a2c7fa36e5 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java @@ -80,13 +80,10 @@ public class TaskViewHeader extends FrameLayout // Header dim, which is only used when task view hardware layers are not used Paint mDimLayerPaint = new Paint(); - PorterDuffColorFilter mDimColorFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP); Interpolator mFastOutSlowInInterpolator; Interpolator mFastOutLinearInInterpolator; - boolean mLayersDisabled; - public TaskViewHeader(Context context) { this(context, null); } @@ -111,6 +108,7 @@ public class TaskViewHeader extends FrameLayout }); // Load the dismiss resources + mDimLayerPaint.setColor(Color.argb(0, 0, 0, 0)); mLightDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_light); mDarkDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_dark); mDismissContentDescription = @@ -173,21 +171,13 @@ public class TaskViewHeader extends FrameLayout canvas.restoreToCount(count); } - @Override - public boolean hasOverlappingRendering() { - return false; - } - /** * Sets the dim alpha, only used when we are not using hardware layers. * (see RecentsConfiguration.useHardwareLayers) */ void setDimAlpha(int alpha) { - mDimColorFilter.setColor(Color.argb(alpha, 0, 0, 0)); - mDimLayerPaint.setColorFilter(mDimColorFilter); - if (!mLayersDisabled) { - setLayerType(LAYER_TYPE_HARDWARE, mDimLayerPaint); - } + mDimLayerPaint.setColor(Color.argb(alpha, 0, 0, 0)); + invalidate(); } /** Returns the secondary color for a primary color. */ @@ -341,23 +331,11 @@ public class TaskViewHeader extends FrameLayout @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); - if (mLayersDisabled) { - mLayersDisabled = false; - postOnAnimation(new Runnable() { - @Override - public void run() { - mLayersDisabled = false; - setLayerType(LAYER_TYPE_HARDWARE, mDimLayerPaint); - } - }); - } - } - - public void disableLayersForOneFrame() { - mLayersDisabled = true; - // Disable layer for a frame so we can draw our first frame faster. - setLayerType(LAYER_TYPE_NONE, null); + // Draw the thumbnail with the rounded corners + canvas.drawRoundRect(0, 0, getWidth(), getHeight(), + mCornerRadius, + mCornerRadius, mDimLayerPaint); } /** Notifies the associated TaskView has been focused. */ diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index 98f3f0c3b60d..93264ff0d003 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -74,7 +74,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, private final Rect mTmpRect = new Rect(); private final Rect mLastResizeRect = new Rect(); - private final WindowManagerProxy mWindowManagerProxy = new WindowManagerProxy(); + private final WindowManagerProxy mWindowManagerProxy = WindowManagerProxy.getInstance(); private Interpolator mFastOutSlowInInterpolator; private final Interpolator mTouchResponseInterpolator = new PathInterpolator(0.3f, 0f, 0.1f, 1f); diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java index 0d3f8038acc6..58de5d53ae37 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/WindowManagerProxy.java @@ -37,6 +37,8 @@ public class WindowManagerProxy { private static final String TAG = "WindowManagerProxy"; + private static final WindowManagerProxy sInstance = new WindowManagerProxy(); + @GuardedBy("mResizeRect") private final Rect mResizeRect = new Rect(); private final Rect mTmpRect = new Rect(); @@ -78,6 +80,13 @@ public class WindowManagerProxy { } }; + private WindowManagerProxy() { + } + + public static WindowManagerProxy getInstance() { + return sInstance; + } + public void resizeDockedStack(Rect rect) { synchronized (mResizeRect) { mResizeRect.set(rect); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java index 1601b83a0d99..a3f404a84314 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java @@ -146,7 +146,8 @@ public class BarTransitions { mWarning = 0xffff0000; } else { mOpaque = context.getColor(R.color.system_bar_background_opaque); - mSemiTransparent = context.getColor(R.color.system_bar_background_semi_transparent); + mSemiTransparent = context.getColor( + com.android.internal.R.color.system_bar_background_semi_transparent); mTransparent = context.getColor(R.color.system_bar_background_transparent); mWarning = context.getColor(com.android.internal.R.color.battery_saver_mode_color); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java index d91bfb925277..a2616fe46efb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java @@ -16,30 +16,29 @@ package com.android.systemui.statusbar.phone; +import android.app.ActivityManager; import android.content.Context; -import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Rect; -import android.os.SystemProperties; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.ViewConfiguration; -import android.view.WindowManager; import com.android.systemui.R; import com.android.systemui.RecentsComponent; import com.android.systemui.stackdivider.Divider; -import com.android.systemui.statusbar.BaseStatusBar; +import com.android.systemui.tuner.TunerService; import static android.view.WindowManager.*; /** * Class to detect gestures on the navigation bar. */ -public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureListener { +public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureListener + implements TunerService.Tunable { - private static final String DOCK_WINDOW_GESTURE_ENABLED_PROP = "persist.dock_gesture_enabled"; + private static final String KEY_DOCK_WINDOW_GESTURE = "overview_nav_bar_gesture"; /** * When dragging from the navigation bar, we drag in recents. @@ -53,6 +52,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL private RecentsComponent mRecentsComponent; private Divider mDivider; + private Context mContext; private boolean mIsVertical; private boolean mIsRTL; @@ -69,13 +69,14 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL private int mDragMode; public NavigationBarGestureHelper(Context context) { + mContext = context; ViewConfiguration configuration = ViewConfiguration.get(context); Resources r = context.getResources(); mScrollTouchSlop = r.getDimensionPixelSize(R.dimen.navigation_bar_min_swipe_distance); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mMinFlingVelocity = configuration.getScaledMinimumFlingVelocity(); mTaskSwitcherDetector = new GestureDetector(context, this); - mDockWindowEnabled = SystemProperties.getBoolean(DOCK_WINDOW_GESTURE_ENABLED_PROP, false); + TunerService.get(context).addTunable(this, KEY_DOCK_WINDOW_GESTURE); } public void setComponents(RecentsComponent recentsComponent, Divider divider) { @@ -172,6 +173,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL == DOCKED_INVALID) { mDragMode = calculateDragMode(); Rect initialBounds = null; + int createMode = ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT; if (mDragMode == DRAG_MODE_DIVIDER) { initialBounds = new Rect(); mDivider.getView().calculateBoundsForPosition(mIsVertical @@ -181,8 +183,12 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL ? DOCKED_TOP : DOCKED_LEFT, initialBounds); + } else if (mDragMode == DRAG_MODE_RECENTS && mTouchDownX + < mContext.getResources().getDisplayMetrics().widthPixels / 2) { + createMode = ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT; } - mRecentsComponent.dockTopTask(mDragMode == DRAG_MODE_RECENTS, initialBounds); + mRecentsComponent.dockTopTask(mDragMode == DRAG_MODE_RECENTS, createMode, + initialBounds); if (mDragMode == DRAG_MODE_DIVIDER) { mDivider.getView().startDragging(); } @@ -259,4 +265,14 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL } return true; } + + @Override + public void onTuningChanged(String key, String newValue) { + switch (key) { + case KEY_DOCK_WINDOW_GESTURE: + mDockWindowEnabled = (newValue != null) && + (Integer.parseInt(newValue) != 0); + break; + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 685c4e5b06ee..e51cf7ac218f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1133,7 +1133,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public boolean onLongClick(View v) { if (mRecents != null) { - mRecents.dockTopTask(false /* draggingInRecents */, null /* initialBounds */); + mRecents.dockTopTask(false /* draggingInRecents */, + ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, + null /* initialBounds */); return true; } return false; @@ -2486,12 +2488,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // update status bar mode final int sbMode = computeBarMode(oldVal, newVal, mStatusBarView.getBarTransitions(), - View.STATUS_BAR_TRANSIENT, View.STATUS_BAR_TRANSLUCENT); + View.STATUS_BAR_TRANSIENT, View.STATUS_BAR_TRANSLUCENT, + View.STATUS_BAR_TRANSPARENT); // update navigation bar mode final int nbMode = mNavigationBarView == null ? -1 : computeBarMode( oldVal, newVal, mNavigationBarView.getBarTransitions(), - View.NAVIGATION_BAR_TRANSIENT, View.NAVIGATION_BAR_TRANSLUCENT); + View.NAVIGATION_BAR_TRANSIENT, View.NAVIGATION_BAR_TRANSLUCENT, + View.NAVIGATION_BAR_TRANSPARENT); final boolean sbModeChanged = sbMode != -1; final boolean nbModeChanged = nbMode != -1; boolean checkBarModes = false; @@ -2542,21 +2546,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } private int computeBarMode(int oldVis, int newVis, BarTransitions transitions, - int transientFlag, int translucentFlag) { - final int oldMode = barMode(oldVis, transientFlag, translucentFlag); - final int newMode = barMode(newVis, transientFlag, translucentFlag); + int transientFlag, int translucentFlag, int transparentFlag) { + final int oldMode = barMode(oldVis, transientFlag, translucentFlag, transparentFlag); + final int newMode = barMode(newVis, transientFlag, translucentFlag, transparentFlag); if (oldMode == newMode) { return -1; // no mode change } return newMode; } - private int barMode(int vis, int transientFlag, int translucentFlag) { - int lightsOutTransparent = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_TRANSPARENT; + private int barMode(int vis, int transientFlag, int translucentFlag, int transparentFlag) { + int lightsOutTransparent = View.SYSTEM_UI_FLAG_LOW_PROFILE | transparentFlag; return (vis & transientFlag) != 0 ? MODE_SEMI_TRANSPARENT : (vis & translucentFlag) != 0 ? MODE_TRANSLUCENT : (vis & lightsOutTransparent) == lightsOutTransparent ? MODE_LIGHTS_OUT_TRANSPARENT - : (vis & View.SYSTEM_UI_TRANSPARENT) != 0 ? MODE_TRANSPARENT + : (vis & transparentFlag) != 0 ? MODE_TRANSPARENT : (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0 ? MODE_LIGHTS_OUT : MODE_OPAQUE; } diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java index 6aa52634d8da..033a4b863ec6 100644 --- a/services/core/java/com/android/server/LockSettingsService.java +++ b/services/core/java/com/android/server/LockSettingsService.java @@ -624,7 +624,13 @@ public class LockSettingsService extends ILockSettings.Stub { byte[] hash = credentialUtil.toHash(credential, userId); if (Arrays.equals(hash, storedHash.hash)) { unlockKeystore(credentialUtil.adjustForKeystore(credential), userId); - unlockUser(userId, null); + + // TODO: pass through a meaningful token from gatekeeper to + // unlock credential keys; for now pass through a stub value to + // indicate that we came from a user challenge. + final byte[] token = String.valueOf(userId).getBytes(); + unlockUser(userId, token); + // migrate credential to GateKeeper credentialUtil.setCredential(credential, null, userId); if (!hasChallenge) { @@ -677,7 +683,13 @@ public class LockSettingsService extends ILockSettings.Stub { if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) { // credential has matched unlockKeystore(credential, userId); - unlockUser(userId, null); + + // TODO: pass through a meaningful token from gatekeeper to + // unlock credential keys; for now pass through a stub value to + // indicate that we came from a user challenge. + final byte[] token = String.valueOf(userId).getBytes(); + unlockUser(userId, token); + UserInfo info = UserManager.get(mContext).getUserInfo(userId); if (LockPatternUtils.isSeparateWorkChallengeEnabled() && info.isManagedProfile()) { TrustManager trustManager = diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index bd43a71173d7..807c0d6be178 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -100,6 +100,7 @@ import com.android.internal.util.FastXmlSerializer; import com.android.internal.util.HexDump; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; +import com.android.internal.widget.LockPatternUtils; import com.android.server.NativeDaemonConnector.Command; import com.android.server.NativeDaemonConnector.SensitiveArg; import com.android.server.pm.PackageManagerService; @@ -435,6 +436,7 @@ class MountService extends IMountService.Stub private PackageManagerService mPms; private final Callbacks mCallbacks; + private final LockPatternUtils mLockPatternUtils; // Two connectors - mConnector & mCryptConnector private final CountDownLatch mConnectedSignal = new CountDownLatch(2); @@ -1429,6 +1431,7 @@ class MountService extends IMountService.Stub mContext = context; mCallbacks = new Callbacks(FgThread.get().getLooper()); + mLockPatternUtils = new LockPatternUtils(mContext); // XXX: This will go away soon in favor of IMountServiceObserver mPms = (PackageManagerService) ServiceManager.getService("package"); @@ -2721,6 +2724,12 @@ class MountService extends IMountService.Stub enforcePermission(android.Manifest.permission.STORAGE_INTERNAL); waitForReady(); + // When a user has secure lock screen, require a challenge token to + // actually unlock. This check is mostly in place for emulation mode. + if (mLockPatternUtils.isSecure(userId) && ArrayUtils.isEmpty(token)) { + throw new IllegalStateException("Token required to unlock secure user " + userId); + } + final String encodedToken; if (ArrayUtils.isEmpty(token)) { encodedToken = "!"; diff --git a/services/core/java/com/android/server/NativeDaemonConnector.java b/services/core/java/com/android/server/NativeDaemonConnector.java index e6b6074abf9c..d6dbad87b060 100644 --- a/services/core/java/com/android/server/NativeDaemonConnector.java +++ b/services/core/java/com/android/server/NativeDaemonConnector.java @@ -177,6 +177,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo mCallbacks.onDaemonConnected(); + FileDescriptor[] fdList = null; byte[] buffer = new byte[BUFFER_SIZE]; int start = 0; @@ -186,6 +187,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo loge("got " + count + " reading with start = " + start); break; } + fdList = socket.getAncillaryFileDescriptors(); // Add our starting point to the count and reset the start. count += start; @@ -200,8 +202,8 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo boolean releaseWl = false; try { - final NativeDaemonEvent event = NativeDaemonEvent.parseRawEvent( - rawEvent); + final NativeDaemonEvent event = + NativeDaemonEvent.parseRawEvent(rawEvent, fdList); log("RCV <- {" + event + "}"); diff --git a/services/core/java/com/android/server/NativeDaemonEvent.java b/services/core/java/com/android/server/NativeDaemonEvent.java index 4e61c0b09de4..e6feda3dad22 100644 --- a/services/core/java/com/android/server/NativeDaemonEvent.java +++ b/services/core/java/com/android/server/NativeDaemonEvent.java @@ -19,6 +19,7 @@ package com.android.server; import android.util.Slog; import com.google.android.collect.Lists; +import java.io.FileDescriptor; import java.util.ArrayList; /** @@ -35,15 +36,17 @@ public class NativeDaemonEvent { private final String mRawEvent; private final String mLogMessage; private String[] mParsed; + private FileDescriptor[] mFdList; private NativeDaemonEvent(int cmdNumber, int code, String message, - String rawEvent, String logMessage) { + String rawEvent, String logMessage, FileDescriptor[] fdList) { mCmdNumber = cmdNumber; mCode = code; mMessage = message; mRawEvent = rawEvent; mLogMessage = logMessage; mParsed = null; + mFdList = fdList; } static public final String SENSITIVE_MARKER = "{{sensitive}}"; @@ -60,6 +63,10 @@ public class NativeDaemonEvent { return mMessage; } + public FileDescriptor[] getFileDescriptors() { + return mFdList; + } + @Deprecated public String getRawEvent() { return mRawEvent; @@ -127,7 +134,7 @@ public class NativeDaemonEvent { * @throws IllegalArgumentException when line doesn't match format expected * from native side. */ - public static NativeDaemonEvent parseRawEvent(String rawEvent) { + public static NativeDaemonEvent parseRawEvent(String rawEvent, FileDescriptor[] fdList) { final String[] parsed = rawEvent.split(" "); if (parsed.length < 2) { throw new IllegalArgumentException("Insufficient arguments"); @@ -164,7 +171,7 @@ public class NativeDaemonEvent { final String message = rawEvent.substring(skiplength); - return new NativeDaemonEvent(cmdNumber, code, message, rawEvent, logMessage); + return new NativeDaemonEvent(cmdNumber, code, message, rawEvent, logMessage, fdList); } /** diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java index 93eaf0e66460..91702cfac2f1 100644 --- a/services/core/java/com/android/server/accounts/AccountManagerService.java +++ b/services/core/java/com/android/server/accounts/AccountManagerService.java @@ -3484,6 +3484,14 @@ public class AccountManagerService return false; } + final ActivityManager am = mContext.getSystemService(ActivityManager.class); + if (am.isUserRunningAndLocked(mAccounts.userId) + && !authenticatorInfo.componentInfo.encryptionAware) { + Slog.w(TAG, "Blocking binding to authenticator " + authenticatorInfo.componentName + + " which isn't encryption aware"); + return false; + } + Intent intent = new Intent(); intent.setAction(AccountManager.ACTION_AUTHENTICATOR_INTENT); intent.setComponent(authenticatorInfo.componentName); @@ -3498,7 +3506,6 @@ public class AccountManagerService return false; } - return true; } } diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 36a7ceea5853..cae8b8ed2800 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -538,9 +538,8 @@ final class ActivityStack { if (addIndex > 0) { final ActivityStack topStack = mStacks.get(addIndex - 1); - if (topStack.mStackId == PINNED_STACK_ID && topStack != this) { - // The pinned stack is always the top most stack (always-on-top). - // So, stack is moved just below the pinned stack. + if (StackId.isAlwaysOnTop(topStack.mStackId) && topStack != this) { + // If the top stack is always on top, we move this stack just below it. addIndex--; } } @@ -1424,16 +1423,15 @@ final class ActivityStack { final void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges, boolean preserveWindows) { ActivityRecord top = topRunningActivityLocked(); - if (top == null) { - return; - } if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "ensureActivitiesVisible behind " + top + " configChanges=0x" + Integer.toHexString(configChanges)); - checkTranslucentActivityWaiting(top); + if (top != null) { + checkTranslucentActivityWaiting(top); + } // If the top activity is not fullscreen, then we need to // make sure any activities under it are now visible. - boolean aboveTop = true; + boolean aboveTop = top != null; final boolean stackInvisible = !isStackVisibleLocked(); boolean behindFullscreenActivity = stackInvisible; boolean noStackActivityResumed = (isInStackLocked(starting) == null); @@ -1447,13 +1445,15 @@ final class ActivityStack { if (r.finishing) { continue; } - if (aboveTop && r != top) { + final boolean isTop = r == top; + if (aboveTop && !isTop) { continue; } aboveTop = false; // mLaunchingBehind: Activities launching behind are at the back of the task stack // but must be drawn initially for the animation as though they were visible. - if (!behindFullscreenActivity || r.mLaunchTaskBehind) { + if ((!behindFullscreenActivity || r.mLaunchTaskBehind) + && okToShowLocked(r)) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Make visible? " + r + " finishing=" + r.finishing + " state=" + r.state); @@ -1464,7 +1464,7 @@ final class ActivityStack { } if (r.app == null || r.app.thread == null) { - if (makeVisibleAndRestartIfNeeded(starting, configChanges, top, + if (makeVisibleAndRestartIfNeeded(starting, configChanges, isTop, noStackActivityResumed, r)) { if (activityNdx >= activities.size()) { // Record may be removed if its process needs to restart. @@ -1474,18 +1474,19 @@ final class ActivityStack { } } } else if (r.visible) { - if (alreadyVisible(r)) { + // If this activity is already visible, then there is nothing to do here. + if (handleAlreadyVisible(r)) { noStackActivityResumed = false; } } else { - becomeVisible(starting, r); + makeVisible(starting, r); } // Aggregate current change flags. configChanges |= r.configChangeFlags; behindFullscreenActivity = updateBehindFullscreen(stackInvisible, behindFullscreenActivity, task, r); } else { - becomeInvisible(stackInvisible, behindFullscreenActivity, r); + makeInvisible(stackInvisible, behindFullscreenActivity, r); } } if (mStackId == FREEFORM_WORKSPACE_STACK_ID) { @@ -1516,12 +1517,12 @@ final class ActivityStack { } private boolean makeVisibleAndRestartIfNeeded(ActivityRecord starting, int configChanges, - ActivityRecord top, boolean noStackActivityResumed, ActivityRecord r) { + boolean isTop, boolean noStackActivityResumed, ActivityRecord r) { // We need to make sure the app is running if it's the top, or it is just made visible from // invisible. If the app is already visible, it must have died while it was visible. In this // case, we'll show the dead window but will not restart the app. Otherwise we could end up // thrashing. - if (r == top || !r.visible) { + if (isTop || !r.visible) { // This activity needs to be visible, but isn't even running... // get it started and resume if no other stack in this stack is resumed. if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Start and freeze screen for " + r); @@ -1540,7 +1541,7 @@ final class ActivityStack { return false; } - private void becomeInvisible(boolean stackInvisible, boolean behindFullscreenActivity, + private void makeInvisible(boolean stackInvisible, boolean behindFullscreenActivity, ActivityRecord r) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Make invisible? " + r + " finishing=" + r.finishing + " state=" + r.state + " stackInvisible=" + stackInvisible @@ -1606,7 +1607,7 @@ final class ActivityStack { return behindFullscreenActivity; } - private void becomeVisible(ActivityRecord starting, ActivityRecord r) { + private void makeVisible(ActivityRecord starting, ActivityRecord r) { // This activity is not currently visible, but is running. Tell it to become visible. r.visible = true; if (r.state != ActivityState.RESUMED && r != starting) { @@ -1631,8 +1632,7 @@ final class ActivityStack { } } - private boolean alreadyVisible(ActivityRecord r) { - // If this activity is already visible, then there is nothing else to do here. + private boolean handleAlreadyVisible(ActivityRecord r) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Skipping: already visible at " + r); r.stopFreezingScreenLocked(false); try { diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index a6af0d10413b..18b3e62f33c5 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2702,7 +2702,6 @@ public final class ActivityStackSupervisor implements DisplayListener { Configuration config) { if (DEBUG_ALL) Slog.v(TAG, "Activity idle: " + token); - ArrayList<ActivityRecord> stops = null; ArrayList<ActivityRecord> finishes = null; ArrayList<UserState> startingUsers = null; int NS = 0; @@ -2756,7 +2755,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } // Atomically retrieve all of the other things to do. - stops = processStoppingActivitiesLocked(true); + final ArrayList<ActivityRecord> stops = processStoppingActivitiesLocked(true); NS = stops != null ? stops.size() : 0; if ((NF = mFinishingActivities.size()) > 0) { finishes = new ArrayList<>(mFinishingActivities); @@ -4304,12 +4303,14 @@ public final class ActivityStackSupervisor implements DisplayListener { mWindowManager.getStackBounds(stack.mStackId, info.bounds); info.displayId = Display.DEFAULT_DISPLAY; info.stackId = stack.mStackId; + info.userId = stack.mCurrentUser; ArrayList<TaskRecord> tasks = stack.getAllTasks(); final int numTasks = tasks.size(); int[] taskIds = new int[numTasks]; String[] taskNames = new String[numTasks]; Rect[] taskBounds = new Rect[numTasks]; + int[] taskUserIds = new int[numTasks]; for (int i = 0; i < numTasks; ++i) { final TaskRecord task = tasks.get(i); taskIds[i] = task.taskId; @@ -4319,10 +4320,12 @@ public final class ActivityStackSupervisor implements DisplayListener { : "unknown"; taskBounds[i] = new Rect(); mWindowManager.getTaskBounds(task.taskId, taskBounds[i]); + taskUserIds[i] = task.userId; } info.taskIds = taskIds; info.taskNames = taskNames; info.taskBounds = taskBounds; + info.taskUserIds = taskUserIds; return info; } diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 195465c96a31..f6f82da6f75c 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -82,8 +82,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import libcore.util.EmptyArray; - /** * Helper class for {@link ActivityManagerService} responsible for multi-user functionality. */ @@ -223,7 +221,7 @@ final class UserController { AppOpsManager.OP_NONE, null, true, false, MY_PID, SYSTEM_UID, userId); } - maybeFinishUserUnlock(uss); + maybeUnlockUser(userId); } } @@ -232,7 +230,7 @@ final class UserController { * {@link UserState#STATE_RUNNING}, which only occurs if the user storage is * actually unlocked. */ - void maybeFinishUserUnlock(UserState uss) { + void finishUserUnlock(UserState uss) { final int userId = uss.mHandle.getIdentifier(); synchronized (mService) { // Bail if we ended up with a stale user @@ -530,9 +528,12 @@ final class UserController { return userManager; } + private IMountService getMountService() { + return IMountService.Stub.asInterface(ServiceManager.getService("mount")); + } + private boolean isUserKeyUnlocked(int userId) { - final IMountService mountService = IMountService.Stub - .asInterface(ServiceManager.getService("mount")); + final IMountService mountService = getMountService(); if (mountService != null) { try { return mountService.isUserKeyUnlocked(userId); @@ -743,6 +744,17 @@ final class UserController { } } + /** + * Attempt to unlock user without a credential token. This typically + * succeeds when the device doesn't have credential-encrypted storage, or + * when the the credential-encrypted storage isn't tied to a user-provided + * PIN or pattern. + */ + boolean maybeUnlockUser(final int userId) { + // Try unlocking storage using empty token + return unlockUserCleared(userId, null); + } + boolean unlockUserCleared(final int userId, byte[] token) { synchronized (mService) { // Bail if already running unlocked @@ -750,19 +762,20 @@ final class UserController { if (uss.state == UserState.STATE_RUNNING) return true; } - final UserInfo userInfo = getUserInfo(userId); - final IMountService mountService = IMountService.Stub - .asInterface(ServiceManager.getService("mount")); - try { - mountService.unlockUserKey(userId, userInfo.serialNumber, token); - } catch (RemoteException e) { - Slog.w(TAG, "Failed to unlock: " + e.getMessage()); - return false; + if (!isUserKeyUnlocked(userId)) { + final UserInfo userInfo = getUserInfo(userId); + final IMountService mountService = getMountService(); + try { + mountService.unlockUserKey(userId, userInfo.serialNumber, token); + } catch (RemoteException | RuntimeException e) { + Slog.w(TAG, "Failed to unlock: " + e.getMessage()); + return false; + } } synchronized (mService) { final UserState uss = mStartedUsers.get(userId); - maybeFinishUserUnlock(uss); + finishUserUnlock(uss); } return true; diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java index 4f538821958c..a06683548537 100644 --- a/services/core/java/com/android/server/content/SyncManager.java +++ b/services/core/java/com/android/server/content/SyncManager.java @@ -422,8 +422,8 @@ public class SyncManager { if (Intent.ACTION_USER_REMOVED.equals(action)) { onUserRemoved(userId); - } else if (Intent.ACTION_USER_STARTING.equals(action)) { - onUserStarting(userId); + } else if (Intent.ACTION_USER_UNLOCKED.equals(action)) { + onUserUnlocked(userId); } else if (Intent.ACTION_USER_STOPPING.equals(action)) { onUserStopping(userId); } @@ -517,7 +517,7 @@ public class SyncManager { intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_USER_REMOVED); - intentFilter.addAction(Intent.ACTION_USER_STARTING); + intentFilter.addAction(Intent.ACTION_USER_UNLOCKED); intentFilter.addAction(Intent.ACTION_USER_STOPPING); mContext.registerReceiverAsUser( mUserIntentReceiver, UserHandle.ALL, intentFilter, null, null); @@ -1292,7 +1292,7 @@ public class SyncManager { } } - private void onUserStarting(int userId) { + private void onUserUnlocked(int userId) { // Make sure that accounts we're about to use are valid AccountManagerService.getSingleton().validateAccounts(userId); @@ -2673,21 +2673,20 @@ public class SyncManager { final Iterator<SyncOperation> operationIterator = mSyncQueue.getOperations().iterator(); - final ActivityManager activityManager - = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); + final ActivityManager am = mContext.getSystemService(ActivityManager.class); final Set<Integer> removedUsers = Sets.newHashSet(); while (operationIterator.hasNext()) { final SyncOperation op = operationIterator.next(); - // If the user is not running, skip the request. - if (!activityManager.isUserRunning(op.target.userId)) { + // If the user is not running unlocked, skip the request. + if (!am.isUserRunningAndUnlocked(op.target.userId)) { final UserInfo userInfo = mUserManager.getUserInfo(op.target.userId); if (userInfo == null) { removedUsers.add(op.target.userId); } if (isLoggable) { Log.v(TAG, " Dropping all sync operations for + " - + op.target.userId + ": user not running."); + + op.target.userId + ": user not running unlocked."); } continue; } diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index ae8fca83754c..f2d0031fa1c5 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -212,6 +212,7 @@ public class InputManagerService extends IInputManager.Stub private static native String nativeDump(long ptr); private static native void nativeMonitor(long ptr); private static native void nativeSetPointerIconShape(long ptr, int iconId); + private static native void nativeReloadPointerIcons(long ptr); // Input event injection constants defined in InputDispatcher.h. private static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0; @@ -311,12 +312,14 @@ public class InputManagerService extends IInputManager.Stub registerPointerSpeedSettingObserver(); registerShowTouchesSettingObserver(); + registerAccessibilityLargePointerSettingObserver(); mContext.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { updatePointerSpeedFromSettings(); updateShowTouchesFromSettings(); + nativeReloadPointerIcons(mPtr); } }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler); @@ -1362,6 +1365,17 @@ public class InputManagerService extends IInputManager.Stub }, UserHandle.USER_ALL); } + private void registerAccessibilityLargePointerSettingObserver() { + mContext.getContentResolver().registerContentObserver( + Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON), true, + new ContentObserver(mHandler) { + @Override + public void onChange(boolean selfChange) { + nativeReloadPointerIcons(mPtr); + } + }, UserHandle.USER_ALL); + } + private int getShowTouchesSetting(int defaultValue) { int result = defaultValue; try { @@ -1431,11 +1445,11 @@ public class InputManagerService extends IInputManager.Stub } } - // Binder call - @Override - public void setPointerIconShape(int iconId) { - nativeSetPointerIconShape(mPtr, iconId); - } + // Binder call + @Override + public void setPointerIconShape(int iconId) { + nativeSetPointerIconShape(mPtr, iconId); + } @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { diff --git a/services/core/java/com/android/server/job/JobStore.java b/services/core/java/com/android/server/job/JobStore.java index 0004c42c13ae..d9f94d0714ae 100644 --- a/services/core/java/com/android/server/job/JobStore.java +++ b/services/core/java/com/android/server/job/JobStore.java @@ -278,6 +278,11 @@ public class JobStore { // Copy over the jobs so we can release the lock before writing. for (int i=0; i<mJobSet.size(); i++) { JobStatus jobStatus = mJobSet.valueAt(i); + + if (!jobStatus.isPersisted()){ + continue; + } + JobStatus copy = new JobStatus(jobStatus.getJob(), jobStatus.getUid(), jobStatus.getEarliestRunTime(), jobStatus.getLatestRunTimeElapsed()); mStoreCopy.add(copy); diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index c2666b8539da..33f39bc8adc0 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1243,6 +1243,20 @@ public class NotificationManagerService extends SystemService { return mRankingHelper.getTopicVisibilityOverride(pkg, uid, topic); } + @Override + public void setTopicImportance(String pkg, int uid, Notification.Topic topic, + int importance) { + checkCallerIsSystem(); + mRankingHelper.setTopicImportance(pkg, uid, topic, importance); + savePolicyFile(); + } + + @Override + public int getTopicImportance(String pkg, int uid, Notification.Topic topic) { + checkCallerIsSystem(); + return mRankingHelper.getTopicImportance(pkg, uid, topic); + } + /** * System-only API for getting a list of current (i.e. not cleared) notifications. * @@ -2201,6 +2215,7 @@ public class NotificationManagerService extends SystemService { } mRankingHelper.extractSignals(r); + savePolicyFile(); // 3. Apply local rules diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index 2a7568db2040..3b7384ee3569 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -23,6 +23,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.Icon; import android.media.AudioAttributes; import android.os.UserHandle; +import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import com.android.internal.annotations.VisibleForTesting; @@ -82,6 +83,7 @@ public final class NotificationRecord { private int mAuthoritativeRank; private String mGlobalSortKey; private int mPackageVisibility; + private int mTopicImportance = NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED; private int mSuppressedVisualEffects = 0; @@ -106,6 +108,7 @@ public final class NotificationRecord { mRankingTimeMs = calculateRankingTimeMs(previous.getRankingTimeMs()); mCreationTimeMs = previous.mCreationTimeMs; mVisibleSinceMs = previous.mVisibleSinceMs; + mTopicImportance = previous.mTopicImportance; // Don't copy mGlobalSortKey, recompute it. } @@ -195,6 +198,8 @@ public final class NotificationRecord { pw.println(prefix + " mRecentlyIntrusive=" + mRecentlyIntrusive); pw.println(prefix + " mPackagePriority=" + mPackagePriority); pw.println(prefix + " mPackageVisibility=" + mPackageVisibility); + pw.println(prefix + " mTopicImportance=" + + NotificationListenerService.Ranking.importanceToString(mTopicImportance)); pw.println(prefix + " mIntercept=" + mIntercept); pw.println(prefix + " mGlobalSortKey=" + mGlobalSortKey); pw.println(prefix + " mRankingTimeMs=" + mRankingTimeMs); @@ -268,6 +273,16 @@ public final class NotificationRecord { return mPackageVisibility; } + public void setTopicImportance(int importance) { + if (importance != NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED) { + mTopicImportance = importance; + } + } + + public int getTopicImportance() { + return mTopicImportance; + } + public boolean setIntercepted(boolean intercept) { mIntercept = intercept; return mIntercept; diff --git a/services/core/java/com/android/server/notification/RankingConfig.java b/services/core/java/com/android/server/notification/RankingConfig.java index 7ee29e45910e..acdd90ae9577 100644 --- a/services/core/java/com/android/server/notification/RankingConfig.java +++ b/services/core/java/com/android/server/notification/RankingConfig.java @@ -31,4 +31,8 @@ public interface RankingConfig { void setTopicVisibilityOverride(String packageName, int uid, Notification.Topic topic, int visibility); + + void setTopicImportance(String packageName, int uid, Notification.Topic topic, int importance); + + int getTopicImportance(String packageName, int uid, Notification.Topic topic); } diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java index 543cd89a4c0f..5a31c6a27a4f 100644 --- a/services/core/java/com/android/server/notification/RankingHelper.java +++ b/services/core/java/com/android/server/notification/RankingHelper.java @@ -23,6 +23,7 @@ import android.os.Handler; import android.os.Message; import android.os.UserHandle; import android.service.notification.NotificationListenerService; +import android.service.notification.NotificationListenerService.Ranking; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Slog; @@ -55,12 +56,13 @@ public class RankingHelper implements RankingConfig { private static final String ATT_UID = "uid"; private static final String ATT_PRIORITY = "priority"; private static final String ATT_VISIBILITY = "visibility"; + private static final String ATT_IMPORTANCE = "importance"; private static final String ATT_TOPIC_ID = "id"; private static final String ATT_TOPIC_LABEL = "label"; private static final int DEFAULT_PRIORITY = Notification.PRIORITY_DEFAULT; - private static final int DEFAULT_VISIBILITY = - NotificationListenerService.Ranking.VISIBILITY_NO_OVERRIDE; + private static final int DEFAULT_VISIBILITY = Ranking.VISIBILITY_NO_OVERRIDE; + private static final int DEFAULT_IMPORTANCE = Ranking.IMPORTANCE_UNSPECIFIED; private final NotificationSignalExtractor[] mSignalExtractors; private final NotificationComparator mPreliminaryComparator = new NotificationComparator(); @@ -197,6 +199,7 @@ public class RankingHelper implements RankingConfig { if (TAG_TOPIC.equals(tagName)) { int priority = safeInt(parser, ATT_PRIORITY, DEFAULT_PRIORITY); int vis = safeInt(parser, ATT_VISIBILITY, DEFAULT_VISIBILITY); + int importance = safeInt(parser, ATT_IMPORTANCE, DEFAULT_IMPORTANCE); String id = parser.getAttributeValue(null, ATT_TOPIC_ID); CharSequence label = parser.getAttributeValue(null, ATT_TOPIC_LABEL); @@ -209,6 +212,9 @@ public class RankingHelper implements RankingConfig { if (vis != DEFAULT_VISIBILITY) { topic.visibility = vis; } + if (importance != DEFAULT_IMPORTANCE) { + topic.importance = importance; + } r.topics.put(id, topic); } } @@ -267,6 +273,9 @@ public class RankingHelper implements RankingConfig { if (t.visibility != DEFAULT_VISIBILITY) { out.attribute(null, ATT_VISIBILITY, Integer.toString(t.visibility)); } + if (t.importance != DEFAULT_IMPORTANCE) { + out.attribute(null, ATT_IMPORTANCE, Integer.toString(t.importance)); + } out.endTag(null, TAG_TOPIC); } } @@ -403,6 +412,20 @@ public class RankingHelper implements RankingConfig { updateConfig(); } + @Override + public int getTopicImportance(String packageName, int uid, Notification.Topic topic) { + final Record r = getOrCreateRecord(packageName, uid); + return getOrCreateTopic(r, topic).importance; + } + + @Override + public void setTopicImportance(String pkgName, int uid, Notification.Topic topic, + int importance) { + final Record r = getOrCreateRecord(pkgName, uid); + getOrCreateTopic(r, topic).importance = importance; + updateConfig(); + } + private Topic getOrCreateTopic(Record r, Notification.Topic topic) { if (topic == null) { topic = createDefaultTopic(); @@ -468,6 +491,10 @@ public class RankingHelper implements RankingConfig { pw.print(" visibility="); pw.print(Notification.visibilityToString(t.visibility)); } + if (t.importance != DEFAULT_IMPORTANCE) { + pw.print(" importance="); + pw.print(Ranking.importanceToString(t.importance)); + } pw.println(); } } @@ -512,6 +539,7 @@ public class RankingHelper implements RankingConfig { Notification.Topic topic; int priority = DEFAULT_PRIORITY; int visibility = DEFAULT_VISIBILITY; + int importance = DEFAULT_IMPORTANCE; public Topic(Notification.Topic topic) { this.topic = topic; diff --git a/services/core/java/com/android/server/notification/TopicImportanceExtractor.java b/services/core/java/com/android/server/notification/TopicImportanceExtractor.java new file mode 100644 index 000000000000..01770d0907b1 --- /dev/null +++ b/services/core/java/com/android/server/notification/TopicImportanceExtractor.java @@ -0,0 +1,56 @@ +/** +* Copyright (C) 2015 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.android.server.notification; + +import android.content.Context; +import android.util.Slog; + +/** + * Determines the importance of the given notification. + */ +public class TopicImportanceExtractor implements NotificationSignalExtractor { + private static final String TAG = "ImportantTopicExtractor"; + private static final boolean DBG = false; + + private RankingConfig mConfig; + + public void initialize(Context ctx, NotificationUsageStats usageStats) { + if (DBG) Slog.d(TAG, "Initializing " + getClass().getSimpleName() + "."); + } + + public RankingReconsideration process(NotificationRecord record) { + if (record == null || record.getNotification() == null) { + if (DBG) Slog.d(TAG, "skipping empty notification"); + return null; + } + + if (mConfig == null) { + if (DBG) Slog.d(TAG, "missing config"); + return null; + } + + final int topicImportance = mConfig.getTopicImportance(record.sbn.getPackageName(), + record.sbn.getUid(), record.sbn.getNotification().getTopic()); + record.setTopicImportance(topicImportance); + + return null; + } + + @Override + public void setConfig(RankingConfig config) { + mConfig = config; + } +} diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 8ef8276967dc..6f1991175f32 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -4868,15 +4868,21 @@ public class PackageManagerService extends IPackageManager.Stub { // Check for results in the current profile. List<ResolveInfo> result = mActivities.queryIntent( intent, resolvedType, flags, userId); + result = filterIfNotSystemUser(result, userId); // Check for cross profile results. + boolean hasNonNegativePriorityResult = hasNonNegativePriority(result); xpResolveInfo = queryCrossProfileIntents( - matchingFilters, intent, resolvedType, flags, userId); + matchingFilters, intent, resolvedType, flags, userId, + hasNonNegativePriorityResult); if (xpResolveInfo != null && isUserEnabled(xpResolveInfo.targetUserId)) { - result.add(xpResolveInfo); - Collections.sort(result, mResolvePrioritySorter); + boolean isVisibleToUser = filterIfNotSystemUser( + Collections.singletonList(xpResolveInfo), userId).size() > 0; + if (isVisibleToUser) { + result.add(xpResolveInfo); + Collections.sort(result, mResolvePrioritySorter); + } } - result = filterIfNotSystemUser(result, userId); if (hasWebURI(intent)) { CrossProfileDomainInfo xpDomainInfo = null; final UserInfo parent = getProfileParent(userId); @@ -5009,6 +5015,14 @@ public class PackageManagerService extends IPackageManager.Stub { return resolveInfos; } + /** + * @param resolveInfos list of resolve infos in descending priority order + * @return if the list contains a resolve info with non-negative priority + */ + private boolean hasNonNegativePriority(List<ResolveInfo> resolveInfos) { + return resolveInfos.size() > 0 && resolveInfos.get(0).priority >= 0; + } + private static boolean hasWebURI(Intent intent) { if (intent.getData() == null) { return false; @@ -5212,10 +5226,10 @@ public class PackageManagerService extends IPackageManager.Stub { return null; } - // Return matching ResolveInfo if any for skip current profile intent filters. + // Return matching ResolveInfo in target user if any. private ResolveInfo queryCrossProfileIntents( List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType, - int flags, int sourceUserId) { + int flags, int sourceUserId, boolean matchInCurrentProfile) { if (matchingFilters != null) { // Two {@link CrossProfileIntentFilter}s can have the same targetUserId and // match the same intent. For performance reasons, it is better not to @@ -5225,8 +5239,12 @@ public class PackageManagerService extends IPackageManager.Stub { for (int i = 0; i < size; i++) { CrossProfileIntentFilter filter = matchingFilters.get(i); int targetUserId = filter.getTargetUserId(); - if ((filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) == 0 - && !alreadyTriedUserIds.get(targetUserId)) { + boolean skipCurrentProfile = + (filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) != 0; + boolean skipCurrentProfileIfNoMatchFound = + (filter.getFlags() & PackageManager.ONLY_IF_NO_MATCH_FOUND) != 0; + if (!skipCurrentProfile && !alreadyTriedUserIds.get(targetUserId) + && (!skipCurrentProfileIfNoMatchFound || !matchInCurrentProfile)) { // Checking if there are activities in the target user that can handle the // intent. ResolveInfo resolveInfo = createForwardingResolveInfo(filter, intent, diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java index dbb58185e447..c549b8cdb29c 100644 --- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java +++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java @@ -101,6 +101,8 @@ class PackageManagerShellCommand extends ShellCommand { return runList(); case "uninstall": return runUninstall(); + case "resolve-activity": + return runResolveActivity(); case "query-intent-activities": return runQueryIntentActivities(); case "query-intent-services": @@ -565,6 +567,28 @@ class PackageManagerShellCommand extends ShellCommand { return intent; } + private int runResolveActivity() { + Intent intent; + try { + intent = parseIntentAndUser(); + } catch (URISyntaxException e) { + throw new RuntimeException(e.getMessage(), e); + } + try { + ResolveInfo ri = mInterface.resolveIntent(intent, null, 0, mTargetUser); + PrintWriter pw = getOutPrintWriter(); + if (ri == null) { + pw.println("No activity found"); + } else { + PrintWriterPrinter pr = new PrintWriterPrinter(pw); + ri.dump(pr, ""); + } + } catch (RemoteException e) { + throw new RuntimeException("Failed calling service", e); + } + return 0; + } + private int runQueryIntentActivities() { Intent intent; try { @@ -1016,6 +1040,8 @@ class PackageManagerShellCommand extends ShellCommand { pw.println(" -s: short summary"); pw.println(" -d: only list dangerous permissions"); pw.println(" -u: list only the permissions users will see"); + pw.println(" resolve-intent [--user USER_ID] INTENT"); + pw.println(" Prints the activity that resolves to the given Intent."); pw.println(" query-intent-activities [--user USER_ID] INTENT"); pw.println(" Prints all activities that can handle the given Intent."); pw.println(" query-intent-services [--user USER_ID] INTENT"); diff --git a/services/core/java/com/android/server/policy/BarController.java b/services/core/java/com/android/server/policy/BarController.java index 051b7fb17d69..0c80ffa55716 100644 --- a/services/core/java/com/android/server/policy/BarController.java +++ b/services/core/java/com/android/server/policy/BarController.java @@ -47,6 +47,7 @@ public class BarController { private final int mTransientFlag; private final int mUnhideFlag; private final int mTranslucentFlag; + private final int mTransparentFlag; private final int mStatusBarManagerId; private final int mTranslucentWmFlag; protected final Handler mHandler; @@ -63,13 +64,14 @@ public class BarController { private boolean mNoAnimationOnNextShow; public BarController(String tag, int transientFlag, int unhideFlag, int translucentFlag, - int statusBarManagerId, int translucentWmFlag) { + int statusBarManagerId, int translucentWmFlag, int transparentFlag) { mTag = "BarController." + tag; mTransientFlag = transientFlag; mUnhideFlag = unhideFlag; mTranslucentFlag = translucentFlag; mStatusBarManagerId = statusBarManagerId; mTranslucentWmFlag = translucentWmFlag; + mTransparentFlag = transparentFlag; mHandler = new Handler(); } @@ -126,13 +128,13 @@ public class BarController { vis &= ~mTranslucentFlag; } if ((fl & WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) { - vis |= View.SYSTEM_UI_TRANSPARENT; + vis |= mTransparentFlag; } else { - vis &= ~View.SYSTEM_UI_TRANSPARENT; + vis &= ~mTransparentFlag; } } else { vis = (vis & ~mTranslucentFlag) | (oldVis & mTranslucentFlag); - vis = (vis & ~View.SYSTEM_UI_TRANSPARENT) | (oldVis & View.SYSTEM_UI_TRANSPARENT); + vis = (vis & ~mTransparentFlag) | (oldVis & mTransparentFlag); } } return vis; @@ -247,7 +249,7 @@ public class BarController { } } if (mShowTransparent) { - vis |= View.SYSTEM_UI_TRANSPARENT; + vis |= mTransparentFlag; if (mSetUnHideFlagWhenNextTransparent) { vis |= mUnhideFlag; mSetUnHideFlagWhenNextTransparent = false; @@ -258,7 +260,7 @@ public class BarController { vis &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE; // never show transient bars in low profile } if ((vis & mTranslucentFlag) != 0 || (oldVis & mTranslucentFlag) != 0 || - ((vis | oldVis) & View.SYSTEM_UI_TRANSPARENT) != 0) { + ((vis | oldVis) & mTransparentFlag) != 0) { mLastTranslucent = SystemClock.uptimeMillis(); } return vis; diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 20310611d130..fe427d36e36b 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -209,7 +209,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { | View.SYSTEM_UI_FLAG_FULLSCREEN | View.STATUS_BAR_TRANSLUCENT | View.NAVIGATION_BAR_TRANSLUCENT - | View.SYSTEM_UI_TRANSPARENT; + | View.STATUS_BAR_TRANSPARENT + | View.NAVIGATION_BAR_TRANSPARENT; private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder() .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) @@ -626,6 +627,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { private final LogDecelerateInterpolator mLogDecelerateInterpolator = new LogDecelerateInterpolator(100, 0); + private boolean mForceWindowDrawsStatusBarBackground; + private static final int MSG_ENABLE_POINTER_LOCATION = 1; private static final int MSG_DISABLE_POINTER_LOCATION = 2; private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3; @@ -806,7 +809,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { View.NAVIGATION_BAR_UNHIDE, View.NAVIGATION_BAR_TRANSLUCENT, StatusBarManager.WINDOW_NAVIGATION_BAR, - WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); + WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, + View.NAVIGATION_BAR_TRANSPARENT); private ImmersiveModeConfirmation mImmersiveModeConfirmation; @@ -1587,6 +1591,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { mScreenshotChordEnabled = mContext.getResources().getBoolean( com.android.internal.R.bool.config_enableScreenshotChord); + mForceWindowDrawsStatusBarBackground = mContext.getResources().getBoolean( + R.bool.config_forceWindowDrawsStatusBarBackground); mGlobalKeyManager = new GlobalKeyManager(mContext); @@ -2049,10 +2055,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { attrs.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; } - if (ActivityManager.isHighEndGfx() - && (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) { - attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + if (ActivityManager.isHighEndGfx()) { + if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) { + attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + } + if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 + || mForceWindowDrawsStatusBarBackground) { + attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + } } } @@ -3609,7 +3619,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final int sysui = mLastSystemUiFlags; boolean navVisible = (sysui & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0; boolean navTranslucent = (sysui - & (View.NAVIGATION_BAR_TRANSLUCENT | View.SYSTEM_UI_TRANSPARENT)) != 0; + & (View.NAVIGATION_BAR_TRANSLUCENT | View.NAVIGATION_BAR_TRANSPARENT)) != 0; boolean immersive = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0; boolean immersiveSticky = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0; boolean navAllowedHidden = immersive || immersiveSticky; @@ -3677,7 +3687,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean statusBarTransient = (sysui & View.STATUS_BAR_TRANSIENT) != 0; boolean statusBarTranslucent = (sysui - & (View.STATUS_BAR_TRANSLUCENT | View.SYSTEM_UI_TRANSPARENT)) != 0; + & (View.STATUS_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSPARENT)) != 0; if (!isKeyguardShowing) { statusBarTranslucent &= areTranslucentBarsAllowed(); } @@ -4008,7 +4018,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { && (fl & WindowManager.LayoutParams.FLAG_FULLSCREEN) == 0 && (fl & WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) == 0 && (fl & WindowManager.LayoutParams. - FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0) { + FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0 + && !mForceWindowDrawsStatusBarBackground) { // Ensure policy decor includes status bar dcf.top = mStableTop; } @@ -6733,10 +6744,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final boolean freeformStackVisible = mWindowManagerInternal.isStackVisible(FREEFORM_WORKSPACE_STACK_ID); final boolean forceShowSystemBars = dockedStackVisible || freeformStackVisible; - // TODO(multi-window): Update to force opaque independently for status bar and nav bar. - // This will require refactoring the code to have separate vis flag for each bar so it can - // be adjusted independently. - final boolean forceOpaqueSystemBars = forceShowSystemBars; + final boolean forceOpaqueSystemBars = forceShowSystemBars && !mForceStatusBarFromKeyguard; // apply translucent bar vis flags WindowState transWin = isStatusBarKeyguard() && !mHideLockScreen @@ -6766,6 +6774,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { | View.SYSTEM_UI_TRANSPARENT); } + if (mForceWindowDrawsStatusBarBackground) { + vis |= View.STATUS_BAR_TRANSPARENT; + vis &= ~View.STATUS_BAR_TRANSLUCENT; + } + // update status bar boolean immersiveSticky = (vis & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0; diff --git a/services/core/java/com/android/server/policy/StatusBarController.java b/services/core/java/com/android/server/policy/StatusBarController.java index b935f5abc74b..9d353c6c0ed7 100644 --- a/services/core/java/com/android/server/policy/StatusBarController.java +++ b/services/core/java/com/android/server/policy/StatusBarController.java @@ -111,7 +111,8 @@ public class StatusBarController extends BarController { View.STATUS_BAR_UNHIDE, View.STATUS_BAR_TRANSLUCENT, StatusBarManager.WINDOW_STATUS_BAR, - WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, + View.STATUS_BAR_TRANSPARENT); } public AppTransitionListener getAppTransitionListener() { diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 4bbf58638896..898a9a414903 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -237,8 +237,8 @@ class DisplayContent { } void moveStack(TaskStack stack, boolean toTop) { - if (stack.mStackId == PINNED_STACK_ID && !toTop) { - // Pinned stack is always-on-top silly... + if (StackId.isAlwaysOnTop(stack.mStackId) && !toTop) { + // This stack is always-on-top silly... Slog.w(TAG, "Ignoring move of always-on-top stack=" + stack + " to bottom"); return; } diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java index df8d5d6f6e9b..32c9b2a654da 100644 --- a/services/core/java/com/android/server/wm/DockedStackDividerController.java +++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java @@ -20,8 +20,6 @@ import android.content.Context; import android.graphics.Rect; import android.os.RemoteException; import android.util.Slog; -import android.util.SparseArray; -import android.util.SparseIntArray; import android.view.IDockDividerVisibilityListener; import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; @@ -46,6 +44,7 @@ public class DockedStackDividerController { private final Rect mLastRect = new Rect(); private IDockDividerVisibilityListener mListener; private boolean mLastVisibility = false; + private boolean mForceVisibilityReevaluation; DockedStackDividerController(Context context, DisplayContent displayContent) { mDisplayContent = displayContent; @@ -69,16 +68,16 @@ public class DockedStackDividerController { void setWindow(WindowState window) { mWindow = window; - reevaluateVisibility(); + reevaluateVisibility(false); } - void reevaluateVisibility() { + void reevaluateVisibility(boolean force) { if (mWindow == null) { return; } TaskStack stack = mDisplayContent.mService.mStackIdToStack.get(DOCKED_STACK_ID); final boolean visible = stack != null && stack.isVisibleLocked(); - if (mLastVisibility == visible) { + if (mLastVisibility == visible && !force) { return; } mLastVisibility = visible; @@ -131,5 +130,6 @@ public class DockedStackDividerController { throw new IllegalStateException("Dock divider visibility listener already set!"); } mListener = listener; + reevaluateVisibility(true); } } diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 22f1d634e955..e4f6c5645446 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -252,7 +252,7 @@ class Task implements DimLayer.DimLayerUser { } int boundsChange = BOUNDS_CHANGE_NONE; - if (mBounds.left != bounds.left || mBounds.right != bounds.right) { + if (mBounds.left != bounds.left || mBounds.top != bounds.top) { boundsChange |= BOUNDS_CHANGE_POSITION; } if (mBounds.width() != bounds.width() || mBounds.height() != bounds.height()) { diff --git a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java index 2f890bef7df3..af109d4195cf 100644 --- a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java +++ b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java @@ -109,6 +109,7 @@ public class TaskTapPointerEventListener implements PointerEventListener { final int y = (int) motionEvent.getY(); final Task task = mDisplayContent.findTaskForControlPoint(x, y); if (task == null) { + mPointerIconShape = STYLE_NOT_SPECIFIED; break; } task.getDimBounds(mTmpRect); @@ -137,6 +138,7 @@ public class TaskTapPointerEventListener implements PointerEventListener { } break; case MotionEvent.ACTION_HOVER_EXIT: + mPointerIconShape = STYLE_NOT_SPECIFIED; motionEvent.getDevice().setPointerShape(STYLE_DEFAULT); break; diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 4736c600e08b..410d8100636c 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -58,6 +58,8 @@ import android.Manifest; import android.animation.ValueAnimator; import android.annotation.NonNull; import android.annotation.Nullable; +import android.app.ActivityManager; +import android.app.ActivityManager.StackId; import android.app.ActivityManagerNative; import android.app.AppOpsManager; import android.app.IActivityManager; @@ -2517,7 +2519,7 @@ public class WindowManagerService extends IWindowManager.Stub } void repositionChild(Session session, IWindow client, - int top, int left, int right, int bottom, + int left, int top, int right, int bottom, long deferTransactionUntilFrame, Rect outFrame) { Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "repositionChild"); long origId = Binder.clearCallingIdentity(); @@ -2538,23 +2540,24 @@ public class WindowManagerService extends IWindowManager.Stub win.mAttrs.y = top; win.mAttrs.width = right - left; win.mAttrs.height = bottom - top; - win.setWindowScale(win.mRequestedWidth, win.mRequestedHeight); - win.mWinAnimator.computeShownFrameLocked(); - if (SHOW_TRANSACTIONS) { Slog.i(TAG, ">>> OPEN TRANSACTION repositionChild"); } SurfaceControl.openTransaction(); + win.applyGravityAndUpdateFrame(); + win.mWinAnimator.computeShownFrameLocked(); + + win.mWinAnimator.setSurfaceBoundariesLocked(false); + if (deferTransactionUntilFrame > 0) { win.mWinAnimator.mSurfaceController.deferTransactionUntil( win.mAttachedWindow.mWinAnimator.mSurfaceController.getHandle(), deferTransactionUntilFrame); } - win.mWinAnimator.setSurfaceBoundariesLocked(false); SurfaceControl.closeTransaction(); if (SHOW_TRANSACTIONS) { @@ -2588,6 +2591,7 @@ public class WindowManagerService extends IWindowManager.Stub if (win == null) { return 0; } + WindowStateAnimator winAnimator = win.mWinAnimator; if (viewVisibility != View.GONE) { win.setRequestedSize(requestedWidth, requestedHeight); @@ -8028,7 +8032,7 @@ public class WindowManagerService extends IWindowManager.Stub case UPDATE_DOCKED_STACK_DIVIDER: { synchronized (mWindowMap) { getDefaultDisplayContentLocked().getDockedDividerController() - .reevaluateVisibility(); + .reevaluateVisibility(false); } } break; @@ -8650,14 +8654,7 @@ public class WindowManagerService extends IWindowManager.Stub } else if (wtoken != null) { winAnimator.mAnimLayer = w.mLayer + wtoken.mAppAnimator.animLayerAdjustment; - if (wtoken.mWillReplaceWindow && wtoken.mReplacingWindow != w - && wtoken.mAnimateReplacingWindow) { - // We know that we will be animating a relaunching window in the near future, - // which will receive a z-order increase. We want the replaced window to - // immediately receive the same treatment, e.g. to be above the dock divider. - w.mLayer += TYPE_LAYER_OFFSET; - winAnimator.mAnimLayer += TYPE_LAYER_OFFSET; - } + forceHigherLayerIfNeeded(w, winAnimator, wtoken); } else { winAnimator.mAnimLayer = w.mLayer; } @@ -8694,6 +8691,30 @@ public class WindowManagerService extends IWindowManager.Stub } } + private void forceHigherLayerIfNeeded(WindowState w, WindowStateAnimator winAnimator, + AppWindowToken wtoken) { + boolean force = false; + if (wtoken.mWillReplaceWindow && wtoken.mReplacingWindow != w + && wtoken.mAnimateReplacingWindow) { + // We know that we will be animating a relaunching window in the near future, + // which will receive a z-order increase. We want the replaced window to + // immediately receive the same treatment, e.g. to be above the dock divider. + force = true; + } + if (!force) { + final TaskStack stack = w.getStack(); + if (stack != null && StackId.isAlwaysOnTop(stack.mStackId)) { + // If the window's stack is always on top, we want to make it above other windows + // also when these windows are animating. + force = true; + } + } + if (force) { + w.mLayer += TYPE_LAYER_OFFSET; + winAnimator.mAnimLayer += TYPE_LAYER_OFFSET; + } + } + void makeWindowFreezingScreenIfNeededLocked(WindowState w) { // If the screen is currently frozen or off, then keep // it frozen/off until this window draws at its new @@ -10193,7 +10214,7 @@ public class WindowManagerService extends IWindowManager.Stub public void setReplacingWindow(IBinder token, boolean animate) { synchronized (mWindowMap) { AppWindowToken appWindowToken = findAppWindowToken(token); - if (appWindowToken == null) { + if (appWindowToken == null || !appWindowToken.isVisible()) { Slog.w(TAG, "Attempted to set replacing window on non-existing app token " + token); return; } diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index cfa2bb370a4e..5e38492b84be 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -72,6 +72,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_SCALED; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW; +import static android.view.WindowManager.LayoutParams.MATCH_PARENT; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; @@ -618,39 +619,6 @@ final class WindowState implements WindowManagerPolicy.WindowState { final int pw = mContainingFrame.width(); final int ph = mContainingFrame.height(); - int w,h; - if ((mAttrs.flags & FLAG_SCALED) != 0) { - if (mAttrs.width < 0) { - w = pw; - } else if (mEnforceSizeCompat) { - w = (int)(mAttrs.width * mGlobalScale + .5f); - } else { - w = mAttrs.width; - } - if (mAttrs.height < 0) { - h = ph; - } else if (mEnforceSizeCompat) { - h = (int)(mAttrs.height * mGlobalScale + .5f); - } else { - h = mAttrs.height; - } - } else { - if (mAttrs.width == WindowManager.LayoutParams.MATCH_PARENT) { - w = pw; - } else if (mEnforceSizeCompat) { - w = (int)(mRequestedWidth * mGlobalScale + .5f); - } else { - w = mRequestedWidth; - } - if (mAttrs.height == WindowManager.LayoutParams.MATCH_PARENT) { - h = ph; - } else if (mEnforceSizeCompat) { - h = (int)(mRequestedHeight * mGlobalScale + .5f); - } else { - h = mRequestedHeight; - } - } - if (!mParentFrame.equals(pf)) { //Slog.i(TAG, "Window " + this + " content frame from " + mParentFrame // + " to " + pf); @@ -676,28 +644,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { final int fw = mFrame.width(); final int fh = mFrame.height(); - float x, y; - if (mEnforceSizeCompat) { - x = mAttrs.x * mGlobalScale; - y = mAttrs.y * mGlobalScale; - } else { - x = mAttrs.x; - y = mAttrs.y; - } - - if (nonFullscreenTask) { - // Make sure window fits in containing frame since it is in a non-fullscreen stack as - // required by {@link Gravity#apply} call. - w = Math.min(w, pw); - h = Math.min(h, ph); - } - - Gravity.apply(mAttrs.gravity, w, h, mContainingFrame, - (int) (x + mAttrs.horizontalMargin * pw), - (int) (y + mAttrs.verticalMargin * ph), mFrame); - - // Now make sure the window fits in the overall display frame. - Gravity.applyDisplay(mAttrs.gravity, mDisplayFrame, mFrame); + applyGravityAndUpdateFrame(); // Calculate the outsets before the content frame gets shrinked to the window frame. if (hasOutsets) { @@ -2229,4 +2176,69 @@ final class WindowState implements WindowManagerPolicy.WindowState { rect.bottom = rect.top + (int)((rect.bottom - rect.top) / mVScale); } } + + void applyGravityAndUpdateFrame() { + final int pw = mContainingFrame.width(); + final int ph = mContainingFrame.height(); + final Task task = getTask(); + final boolean nonFullscreenTask = task != null && !task.isFullscreen(); + + float x, y; + int w,h; + + if ((mAttrs.flags & FLAG_SCALED) != 0) { + if (mAttrs.width < 0) { + w = pw; + } else if (mEnforceSizeCompat) { + w = (int)(mAttrs.width * mGlobalScale + .5f); + } else { + w = mAttrs.width; + } + if (mAttrs.height < 0) { + h = ph; + } else if (mEnforceSizeCompat) { + h = (int)(mAttrs.height * mGlobalScale + .5f); + } else { + h = mAttrs.height; + } + } else { + if (mAttrs.width == MATCH_PARENT) { + w = pw; + } else if (mEnforceSizeCompat) { + w = (int)(mRequestedWidth * mGlobalScale + .5f); + } else { + w = mRequestedWidth; + } + if (mAttrs.height == MATCH_PARENT) { + h = ph; + } else if (mEnforceSizeCompat) { + h = (int)(mRequestedHeight * mGlobalScale + .5f); + } else { + h = mRequestedHeight; + } + } + + if (mEnforceSizeCompat) { + x = mAttrs.x * mGlobalScale; + y = mAttrs.y * mGlobalScale; + } else { + x = mAttrs.x; + y = mAttrs.y; + } + + if (nonFullscreenTask) { + // Make sure window fits in containing frame since it is in a non-fullscreen stack as + // required by {@link Gravity#apply} call. + w = Math.min(w, pw); + h = Math.min(h, ph); + } + + // Set mFrame + Gravity.apply(mAttrs.gravity, w, h, mContainingFrame, + (int) (x + mAttrs.horizontalMargin * pw), + (int) (y + mAttrs.verticalMargin * ph), mFrame); + + // Now make sure the window fits in the overall display frame. + Gravity.applyDisplay(mAttrs.gravity, mDisplayFrame, mFrame); + } } diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index b5654eebd34f..9c9a5dae1600 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -205,6 +205,7 @@ public: void setInteractive(bool interactive); void reloadCalibration(); void setPointerIconShape(int32_t iconId); + void reloadPointerIcons(); /* --- InputReaderPolicyInterface implementation --- */ @@ -242,6 +243,7 @@ public: /* --- PointerControllerPolicyInterface implementation --- */ + virtual void loadPointerIcon(SpriteIcon* icon); virtual void loadPointerResources(PointerResources* outResources); virtual void loadAdditionalMouseResources(std::map<int32_t, SpriteIcon>* outResources, std::map<int32_t, PointerAnimation>* outAnimationResources); @@ -477,22 +479,6 @@ sp<PointerControllerInterface> NativeInputManager::obtainPointerController(int32 v.logicalBottom - v.logicalTop, v.orientation); - JNIEnv* env = jniEnv(); - jobject pointerIconObj = env->CallObjectMethod(mServiceObj, - gServiceClassInfo.getPointerIcon); - if (!checkAndClearExceptionFromCallback(env, "getPointerIcon")) { - PointerIcon pointerIcon; - status_t status = android_view_PointerIcon_load(env, pointerIconObj, - mContextObj, &pointerIcon); - if (!status && !pointerIcon.isNullIcon()) { - controller->setPointerIcon(SpriteIcon(pointerIcon.bitmap, - pointerIcon.hotSpotX, pointerIcon.hotSpotY)); - } else { - controller->setPointerIcon(SpriteIcon()); - } - env->DeleteLocalRef(pointerIconObj); - } - updateInactivityTimeoutLocked(controller); } return controller; @@ -789,12 +775,19 @@ void NativeInputManager::reloadCalibration() { } void NativeInputManager::setPointerIconShape(int32_t iconId) { - AutoMutex _l(mLock); - sp<PointerController> controller = mLocked.pointerController.promote(); - if (controller != NULL) { - // Use 0 (the default icon) for ARROW. + AutoMutex _l(mLock); + sp<PointerController> controller = mLocked.pointerController.promote(); + if (controller != NULL) { controller->updatePointerShape(iconId); - } + } +} + +void NativeInputManager::reloadPointerIcons() { + AutoMutex _l(mLock); + sp<PointerController> controller = mLocked.pointerController.promote(); + if (controller != NULL) { + controller->reloadPointerResources(); + } } TouchAffineTransformation NativeInputManager::getTouchAffineTransformation( @@ -1036,6 +1029,25 @@ bool NativeInputManager::checkInjectEventsPermissionNonReentrant( return result; } +void NativeInputManager::loadPointerIcon(SpriteIcon* icon) { + JNIEnv* env = jniEnv(); + + ScopedLocalRef<jobject> pointerIconObj(env, env->CallObjectMethod( + mServiceObj, gServiceClassInfo.getPointerIcon)); + if (checkAndClearExceptionFromCallback(env, "getPointerIcon")) { + return; + } + + PointerIcon pointerIcon; + status_t status = android_view_PointerIcon_load(env, pointerIconObj.get(), + mContextObj, &pointerIcon); + if (!status && !pointerIcon.isNullIcon()) { + *icon = SpriteIcon(pointerIcon.bitmap, pointerIcon.hotSpotX, pointerIcon.hotSpotY); + } else { + *icon = SpriteIcon(); + } +} + void NativeInputManager::loadPointerResources(PointerResources* outResources) { JNIEnv* env = jniEnv(); @@ -1420,6 +1432,11 @@ static void nativeSetPointerIconShape(JNIEnv* /* env */, jclass /* clazz */, jlo im->setPointerIconShape(iconId); } +static void nativeReloadPointerIcons(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); + im->reloadPointerIcons(); +} + // ---------------------------------------------------------------------------- static const JNINativeMethod gInputManagerMethods[] = { @@ -1480,6 +1497,8 @@ static const JNINativeMethod gInputManagerMethods[] = { (void*) nativeMonitor }, { "nativeSetPointerIconShape", "(JI)V", (void*) nativeSetPointerIconShape }, + { "nativeReloadPointerIcons", "(J)V", + (void*) nativeReloadPointerIcons }, }; #define FIND_CLASS(var, className) \ diff --git a/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java index f9aa124e2bc4..5b4803b58c0a 100644 --- a/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/accounts/AccountManagerServiceTest.java @@ -195,8 +195,8 @@ public class AccountManagerServiceTest extends AndroidTestCase { mServices = new ArrayList<ServiceInfo<AuthenticatorDescription>>(); AuthenticatorDescription d1 = new AuthenticatorDescription("type1", "p1", 0, 0, 0, 0); AuthenticatorDescription d2 = new AuthenticatorDescription("type2", "p2", 0, 0, 0, 0); - mServices.add(new ServiceInfo<AuthenticatorDescription>(d1, null, 0)); - mServices.add(new ServiceInfo<AuthenticatorDescription>(d2, null, 0)); + mServices.add(new ServiceInfo<AuthenticatorDescription>(d1, null, null)); + mServices.add(new ServiceInfo<AuthenticatorDescription>(d2, null, null)); } @Override diff --git a/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java b/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java index 0b73beb8e3b7..312b1b088bf1 100644 --- a/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java +++ b/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java @@ -183,6 +183,28 @@ public class JobStoreTest extends AndroidTestCase { } /** + * Test that non persisted job is not written to disk. + */ + public void testNonPersistedTaskIsNotPersisted() throws Exception { + JobInfo.Builder b = new Builder(42, mComponent) + .setOverrideDeadline(10000) + .setPersisted(false); + JobStatus jsNonPersisted = new JobStatus(b.build(), SOME_UID); + mTaskStoreUnderTest.add(jsNonPersisted); + b = new Builder(43, mComponent) + .setOverrideDeadline(10000) + .setPersisted(true); + JobStatus jsPersisted = new JobStatus(b.build(), SOME_UID); + mTaskStoreUnderTest.add(jsPersisted); + Thread.sleep(IO_WAIT); + final ArraySet<JobStatus> jobStatusSet = new ArraySet<JobStatus>(); + mTaskStoreUnderTest.readJobMapFromDisk(jobStatusSet); + assertEquals("Job count is incorrect.", 1, jobStatusSet.size()); + JobStatus jobStatus = jobStatusSet.iterator().next(); + assertEquals("Wrong job persisted.", 43, jobStatus.getJobId()); + } + + /** * Helper function to throw an error if the provided task and TaskStatus objects are not equal. */ private void assertTasksEqual(JobInfo first, JobInfo second) { diff --git a/services/tests/servicestests/src/com/android/server/notification/RankingHelperTest.java b/services/tests/servicestests/src/com/android/server/notification/RankingHelperTest.java index b40fd068e58a..d0065cd4b181 100644 --- a/services/tests/servicestests/src/com/android/server/notification/RankingHelperTest.java +++ b/services/tests/servicestests/src/com/android/server/notification/RankingHelperTest.java @@ -15,10 +15,17 @@ */ package com.android.server.notification; +import static android.service.notification.NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED; +import static android.service.notification.NotificationListenerService.Ranking.IMPORTANCE_HIGH; +import static android.service.notification.NotificationListenerService.Ranking.IMPORTANCE_LOW; +import static android.service.notification.NotificationListenerService.Ranking.IMPORTANCE_MAX; +import static android.service.notification.NotificationListenerService.Ranking.IMPORTANCE_NONE; + import org.mockito.Mock; import org.mockito.MockitoAnnotations; import android.app.Notification; +import android.os.Handler; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.test.AndroidTestCase; @@ -28,6 +35,7 @@ import java.util.ArrayList; public class RankingHelperTest extends AndroidTestCase { @Mock NotificationUsageStats mUsageStats; + @Mock Handler handler; private Notification mNotiGroupGSortA; private Notification mNotiGroupGSortB; @@ -46,13 +54,15 @@ public class RankingHelperTest extends AndroidTestCase { MockitoAnnotations.initMocks(this); UserHandle user = UserHandle.ALL; - mHelper = new RankingHelper(getContext(), null, mUsageStats, new String[0]); + mHelper = new RankingHelper(getContext(), handler, mUsageStats, + new String[] {TopicImportanceExtractor.class.getName()}); mNotiGroupGSortA = new Notification.Builder(getContext()) .setContentTitle("A") .setGroup("G") .setSortKey("A") .setWhen(1205) + .setTopic(new Notification.Topic("A", "a")) .build(); mRecordGroupGSortA = new NotificationRecord(new StatusBarNotification( "package", "package", 1, null, 0, 0, 0, mNotiGroupGSortA, user), 0); @@ -62,6 +72,7 @@ public class RankingHelperTest extends AndroidTestCase { .setGroup("G") .setSortKey("B") .setWhen(1200) + .setTopic(new Notification.Topic("A", "a")) .build(); mRecordGroupGSortB = new NotificationRecord(new StatusBarNotification( "package", "package", 1, null, 0, 0, 0, mNotiGroupGSortB, user), 0); @@ -69,6 +80,7 @@ public class RankingHelperTest extends AndroidTestCase { mNotiNoGroup = new Notification.Builder(getContext()) .setContentTitle("C") .setWhen(1201) + .setTopic(new Notification.Topic("C", "c")) .build(); mRecordNoGroup = new NotificationRecord(new StatusBarNotification( "package", "package", 1, null, 0, 0, 0, mNotiNoGroup, user), 0); @@ -76,6 +88,7 @@ public class RankingHelperTest extends AndroidTestCase { mNotiNoGroup2 = new Notification.Builder(getContext()) .setContentTitle("D") .setWhen(1202) + .setTopic(new Notification.Topic("D", "d")) .build(); mRecordNoGroup2 = new NotificationRecord(new StatusBarNotification( "package", "package", 1, null, 0, 0, 0, mNotiNoGroup2, user), 0); @@ -84,6 +97,7 @@ public class RankingHelperTest extends AndroidTestCase { .setContentTitle("E") .setWhen(1201) .setSortKey("A") + .setTopic(new Notification.Topic("E", "e")) .build(); mRecordNoGroupSortA = new NotificationRecord(new StatusBarNotification( "package", "package", 1, null, 0, 0, 0, mNotiNoGroupSortA, user), 0); @@ -138,4 +152,30 @@ public class RankingHelperTest extends AndroidTestCase { ArrayList<NotificationRecord> notificationList = new ArrayList<NotificationRecord>(); mHelper.sort(notificationList); } + + @SmallTest + public void testTopicImportanceExtractor() throws Exception { + mHelper.setTopicImportance("package", 0, new Notification.Topic("A", "a"), + IMPORTANCE_MAX); + // There is no B. There never was a b. Moving on... + mHelper.setTopicImportance("package", 0, new Notification.Topic("C", "c"), + IMPORTANCE_HIGH); + mHelper.setTopicImportance("package", 0, new Notification.Topic("D", "d"), + IMPORTANCE_LOW); + // watch out: different package. + mHelper.setTopicImportance("package2", 0, new Notification.Topic("E", "e"), + IMPORTANCE_NONE); + + TopicImportanceExtractor validator = mHelper.findExtractor(TopicImportanceExtractor.class); + validator.process(mRecordGroupGSortA); + validator.process(mRecordGroupGSortB); + validator.process(mRecordNoGroup); + validator.process(mRecordNoGroup2); + validator.process(mRecordNoGroupSortA); + assertTrue(mRecordGroupGSortA.getTopicImportance() == IMPORTANCE_MAX); + assertTrue(mRecordGroupGSortB.getTopicImportance() == IMPORTANCE_MAX); + assertTrue(mRecordNoGroup.getTopicImportance() == IMPORTANCE_HIGH); + assertTrue(mRecordNoGroup2.getTopicImportance() == IMPORTANCE_LOW); + assertTrue(mRecordNoGroupSortA.getTopicImportance() == IMPORTANCE_UNSPECIFIED); + } } diff --git a/services/usb/java/com/android/server/usb/UsbSettingsManager.java b/services/usb/java/com/android/server/usb/UsbSettingsManager.java index 154cbd30d836..4786d11fb4b4 100644 --- a/services/usb/java/com/android/server/usb/UsbSettingsManager.java +++ b/services/usb/java/com/android/server/usb/UsbSettingsManager.java @@ -984,7 +984,14 @@ class UsbSettingsManager { public boolean hasPermission(UsbDevice device) { synchronized (mLock) { int uid = Binder.getCallingUid(); - if (uid == Process.SYSTEM_UID || mDisablePermissionDialogs) { + int androidMediaUid; + try { + androidMediaUid = mPackageManager.getApplicationInfo("com.android.mtp", 0).uid; + } catch (NameNotFoundException e) { + androidMediaUid = -1; + } + if (uid == Process.SYSTEM_UID || UserHandle.getAppId(uid) == androidMediaUid || + mDisablePermissionDialogs) { return true; } SparseBooleanArray uidList = mDevicePermissionMap.get(device.getDeviceName()); diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java index 5a1559aa7e65..2606466146e3 100644 --- a/telephony/java/android/telephony/CellSignalStrengthLte.java +++ b/telephony/java/android/telephony/CellSignalStrengthLte.java @@ -168,6 +168,20 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P } /** + * @hide + */ + public int getRsrq() { + return mRsrq; + } + + /** + * @hide + */ + public int getRssnr() { + return mRssnr; + } + + /** * Get signal strength as dBm */ @Override diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index b430340a8963..553221d579ec 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -2354,7 +2354,7 @@ public class PhoneNumberUtils tempDialStr = postDialStr.substring(dialableIndex); } else { // Non-dialable character such as P/W should not be at the end of - // the dial string after P/W processing in CdmaConnection.java + // the dial string after P/W processing in GsmCdmaConnection.java // Set the postDialStr to "" to break out of the loop if (dialableIndex < 0) { postDialStr = ""; diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 13374879f09b..8537f9cf2f86 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -906,7 +906,7 @@ public class ServiceState implements Parcelable { /** * In CDMA, mOperatorAlphaLong can be set from the ERI text. - * This is done from the CDMAPhone and not from the CdmaServiceStateTracker. + * This is done from the GsmCdmaPhone and not from the ServiceStateTracker. * * @hide */ diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 3fb966742b6f..7a5a74ff6584 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -188,6 +188,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final String WIFI_AP_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_AP_STATE_CHANGED"; @@ -204,6 +205,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final String EXTRA_WIFI_AP_STATE = "wifi_state"; /** @@ -222,6 +224,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state"; /** * Wi-Fi AP is currently being disabled. The state will change to @@ -232,6 +235,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final int WIFI_AP_STATE_DISABLING = 10; /** * Wi-Fi AP is disabled. @@ -241,6 +245,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final int WIFI_AP_STATE_DISABLED = 11; /** * Wi-Fi AP is currently being enabled. The state will change to @@ -251,6 +256,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final int WIFI_AP_STATE_ENABLING = 12; /** * Wi-Fi AP is enabled. @@ -260,6 +266,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final int WIFI_AP_STATE_ENABLED = 13; /** * Wi-Fi AP is in a failed state. This state will occur when an error occurs during @@ -270,6 +277,7 @@ public class WifiManager { * * @hide */ + @SystemApi public static final int WIFI_AP_STATE_FAILED = 14; /** |