diff options
Diffstat (limited to 'core')
44 files changed, 870 insertions, 733 deletions
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java index bde8f39..40eb799 100644 --- a/core/java/android/app/ActivityManagerInternal.java +++ b/core/java/android/app/ActivityManagerInternal.java @@ -17,6 +17,7 @@ package android.app; import android.annotation.NonNull; +import android.content.ComponentName; /** * Activity manager local system service interface. @@ -48,4 +49,10 @@ public abstract class ActivityManagerInternal { */ public abstract void release(); } + + /** + * Returns home activity for the specified user. + * @param userId ID of the user or {@link android.os.UserHandle#USER_ALL} + */ + public abstract ComponentName getHomeActivityForUser(int userId); } diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index f16406a..f506d59 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -571,8 +571,6 @@ public final class ActivityThread { private native void dumpGraphicsInfo(FileDescriptor fd); private class ApplicationThread extends ApplicationThreadNative { - private static final String ONE_COUNT_COLUMN = "%21s %8d"; - private static final String TWO_COUNT_COLUMNS = "%21s %8d %21s %8d"; private static final String DB_INFO_FORMAT = " %8s %8s %14s %14s %s"; private int mLastProcessState = -1; @@ -972,18 +970,18 @@ public final class ActivityThread { @Override public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, - boolean dumpFullInfo, boolean dumpDalvik, String[] args) { + boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) { FileOutputStream fout = new FileOutputStream(fd); PrintWriter pw = new FastPrintWriter(fout); try { - dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik); + dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly); } finally { pw.flush(); } } private void dumpMemInfo(PrintWriter pw, Debug.MemoryInfo memInfo, boolean checkin, - boolean dumpFullInfo, boolean dumpDalvik) { + boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly) { long nativeMax = Debug.getNativeHeapSize() / 1024; long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024; long nativeFree = Debug.getNativeHeapFreeSize() / 1024; @@ -1007,7 +1005,8 @@ public final class ActivityThread { long openSslSocketCount = Debug.countInstancesOfClass(OpenSSLSocketImpl.class); SQLiteDebug.PagerStats stats = SQLiteDebug.getDatabaseInfo(); - dumpMemInfoTable(pw, memInfo, checkin, dumpFullInfo, dumpDalvik, Process.myPid(), + dumpMemInfoTable(pw, memInfo, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly, + Process.myPid(), (mBoundApplication != null) ? mBoundApplication.processName : "unknown", nativeMax, nativeAllocated, nativeFree, dalvikMax, dalvikAllocated, dalvikFree); @@ -1935,6 +1934,9 @@ public final class ActivityThread { = "%13s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s"; private static final String HEAP_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s"; + private static final String ONE_COUNT_COLUMN = "%21s %8d"; + private static final String TWO_COUNT_COLUMNS = "%21s %8d %21s %8d"; + private static final String ONE_COUNT_COLUMN_HEADER = "%21s %8s"; // Formatting for checkin service - update version if row format changes private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 3; @@ -1944,7 +1946,8 @@ public final class ActivityThread { } public static void dumpMemInfoTable(PrintWriter pw, Debug.MemoryInfo memInfo, boolean checkin, - boolean dumpFullInfo, boolean dumpDalvik, int pid, String processName, + boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, + int pid, String processName, long nativeMax, long nativeAllocated, long nativeFree, long dalvikMax, long dalvikAllocated, long dalvikFree) { @@ -2025,106 +2028,50 @@ public final class ActivityThread { return; } - // otherwise, show human-readable format - if (dumpFullInfo) { - printRow(pw, HEAP_FULL_COLUMN, "", "Pss", "Pss", "Shared", "Private", - "Shared", "Private", "Swapped", "Heap", "Heap", "Heap"); - printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "Dirty", - "Clean", "Clean", "Dirty", "Size", "Alloc", "Free"); - printRow(pw, HEAP_FULL_COLUMN, "", "------", "------", "------", "------", - "------", "------", "------", "------", "------", "------"); - printRow(pw, HEAP_FULL_COLUMN, "Native Heap", memInfo.nativePss, - memInfo.nativeSwappablePss, memInfo.nativeSharedDirty, - memInfo.nativePrivateDirty, memInfo.nativeSharedClean, - memInfo.nativePrivateClean, memInfo.nativeSwappedOut, - nativeMax, nativeAllocated, nativeFree); - printRow(pw, HEAP_FULL_COLUMN, "Dalvik Heap", memInfo.dalvikPss, - memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty, - memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, - memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut, - dalvikMax, dalvikAllocated, dalvikFree); - } else { - printRow(pw, HEAP_COLUMN, "", "Pss", "Private", - "Private", "Swapped", "Heap", "Heap", "Heap"); - printRow(pw, HEAP_COLUMN, "", "Total", "Dirty", - "Clean", "Dirty", "Size", "Alloc", "Free"); - printRow(pw, HEAP_COLUMN, "", "------", "------", "------", - "------", "------", "------", "------", "------"); - printRow(pw, HEAP_COLUMN, "Native Heap", memInfo.nativePss, - memInfo.nativePrivateDirty, - memInfo.nativePrivateClean, memInfo.nativeSwappedOut, - nativeMax, nativeAllocated, nativeFree); - printRow(pw, HEAP_COLUMN, "Dalvik Heap", memInfo.dalvikPss, - memInfo.dalvikPrivateDirty, - memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut, - dalvikMax, dalvikAllocated, dalvikFree); - } - - int otherPss = memInfo.otherPss; - int otherSwappablePss = memInfo.otherSwappablePss; - int otherSharedDirty = memInfo.otherSharedDirty; - int otherPrivateDirty = memInfo.otherPrivateDirty; - int otherSharedClean = memInfo.otherSharedClean; - int otherPrivateClean = memInfo.otherPrivateClean; - int otherSwappedOut = memInfo.otherSwappedOut; - - for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) { - final int myPss = memInfo.getOtherPss(i); - final int mySwappablePss = memInfo.getOtherSwappablePss(i); - final int mySharedDirty = memInfo.getOtherSharedDirty(i); - final int myPrivateDirty = memInfo.getOtherPrivateDirty(i); - final int mySharedClean = memInfo.getOtherSharedClean(i); - final int myPrivateClean = memInfo.getOtherPrivateClean(i); - final int mySwappedOut = memInfo.getOtherSwappedOut(i); - if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 - || mySharedClean != 0 || myPrivateClean != 0 || mySwappedOut != 0) { - if (dumpFullInfo) { - printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i), - myPss, mySwappablePss, mySharedDirty, myPrivateDirty, - mySharedClean, myPrivateClean, mySwappedOut, "", "", ""); - } else { - printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i), - myPss, myPrivateDirty, - myPrivateClean, mySwappedOut, "", "", ""); - } - otherPss -= myPss; - otherSwappablePss -= mySwappablePss; - otherSharedDirty -= mySharedDirty; - otherPrivateDirty -= myPrivateDirty; - otherSharedClean -= mySharedClean; - otherPrivateClean -= myPrivateClean; - otherSwappedOut -= mySwappedOut; - } - } - - if (dumpFullInfo) { - printRow(pw, HEAP_FULL_COLUMN, "Unknown", otherPss, otherSwappablePss, - otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean, - otherSwappedOut, "", "", ""); - printRow(pw, HEAP_FULL_COLUMN, "TOTAL", memInfo.getTotalPss(), - memInfo.getTotalSwappablePss(), - memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(), - memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(), - memInfo.getTotalSwappedOut(), nativeMax+dalvikMax, - nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); - } else { - printRow(pw, HEAP_COLUMN, "Unknown", otherPss, - otherPrivateDirty, otherPrivateClean, otherSwappedOut, - "", "", ""); - printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(), - memInfo.getTotalPrivateDirty(), - memInfo.getTotalPrivateClean(), - memInfo.getTotalSwappedOut(), - nativeMax+dalvikMax, - nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); - } - - if (dumpDalvik) { - pw.println(" "); - pw.println(" Dalvik Details"); + if (!dumpSummaryOnly) { + if (dumpFullInfo) { + printRow(pw, HEAP_FULL_COLUMN, "", "Pss", "Pss", "Shared", "Private", + "Shared", "Private", "Swapped", "Heap", "Heap", "Heap"); + printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "Dirty", + "Clean", "Clean", "Dirty", "Size", "Alloc", "Free"); + printRow(pw, HEAP_FULL_COLUMN, "", "------", "------", "------", "------", + "------", "------", "------", "------", "------", "------"); + printRow(pw, HEAP_FULL_COLUMN, "Native Heap", memInfo.nativePss, + memInfo.nativeSwappablePss, memInfo.nativeSharedDirty, + memInfo.nativePrivateDirty, memInfo.nativeSharedClean, + memInfo.nativePrivateClean, memInfo.nativeSwappedOut, + nativeMax, nativeAllocated, nativeFree); + printRow(pw, HEAP_FULL_COLUMN, "Dalvik Heap", memInfo.dalvikPss, + memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty, + memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, + memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut, + dalvikMax, dalvikAllocated, dalvikFree); + } else { + printRow(pw, HEAP_COLUMN, "", "Pss", "Private", + "Private", "Swapped", "Heap", "Heap", "Heap"); + printRow(pw, HEAP_COLUMN, "", "Total", "Dirty", + "Clean", "Dirty", "Size", "Alloc", "Free"); + printRow(pw, HEAP_COLUMN, "", "------", "------", "------", + "------", "------", "------", "------", "------"); + printRow(pw, HEAP_COLUMN, "Native Heap", memInfo.nativePss, + memInfo.nativePrivateDirty, + memInfo.nativePrivateClean, memInfo.nativeSwappedOut, + nativeMax, nativeAllocated, nativeFree); + printRow(pw, HEAP_COLUMN, "Dalvik Heap", memInfo.dalvikPss, + memInfo.dalvikPrivateDirty, + memInfo.dalvikPrivateClean, memInfo.dalvikSwappedOut, + dalvikMax, dalvikAllocated, dalvikFree); + } + + int otherPss = memInfo.otherPss; + int otherSwappablePss = memInfo.otherSwappablePss; + int otherSharedDirty = memInfo.otherSharedDirty; + int otherPrivateDirty = memInfo.otherPrivateDirty; + int otherSharedClean = memInfo.otherSharedClean; + int otherPrivateClean = memInfo.otherPrivateClean; + int otherSwappedOut = memInfo.otherSwappedOut; - for (int i=Debug.MemoryInfo.NUM_OTHER_STATS; - i<Debug.MemoryInfo.NUM_OTHER_STATS + Debug.MemoryInfo.NUM_DVK_STATS; i++) { + for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) { final int myPss = memInfo.getOtherPss(i); final int mySwappablePss = memInfo.getOtherSwappablePss(i); final int mySharedDirty = memInfo.getOtherSharedDirty(i); @@ -2133,7 +2080,7 @@ public final class ActivityThread { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 - || mySharedClean != 0 || myPrivateClean != 0) { + || mySharedClean != 0 || myPrivateClean != 0 || mySwappedOut != 0) { if (dumpFullInfo) { printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i), myPss, mySwappablePss, mySharedDirty, myPrivateDirty, @@ -2143,9 +2090,89 @@ public final class ActivityThread { myPss, myPrivateDirty, myPrivateClean, mySwappedOut, "", "", ""); } + otherPss -= myPss; + otherSwappablePss -= mySwappablePss; + otherSharedDirty -= mySharedDirty; + otherPrivateDirty -= myPrivateDirty; + otherSharedClean -= mySharedClean; + otherPrivateClean -= myPrivateClean; + otherSwappedOut -= mySwappedOut; + } + } + + if (dumpFullInfo) { + printRow(pw, HEAP_FULL_COLUMN, "Unknown", otherPss, otherSwappablePss, + otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean, + otherSwappedOut, "", "", ""); + printRow(pw, HEAP_FULL_COLUMN, "TOTAL", memInfo.getTotalPss(), + memInfo.getTotalSwappablePss(), + memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(), + memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(), + memInfo.getTotalSwappedOut(), nativeMax+dalvikMax, + nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); + } else { + printRow(pw, HEAP_COLUMN, "Unknown", otherPss, + otherPrivateDirty, otherPrivateClean, otherSwappedOut, + "", "", ""); + printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(), + memInfo.getTotalPrivateDirty(), + memInfo.getTotalPrivateClean(), + memInfo.getTotalSwappedOut(), + nativeMax+dalvikMax, + nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); + } + + if (dumpDalvik) { + pw.println(" "); + pw.println(" Dalvik Details"); + + for (int i=Debug.MemoryInfo.NUM_OTHER_STATS; + i<Debug.MemoryInfo.NUM_OTHER_STATS + Debug.MemoryInfo.NUM_DVK_STATS; i++) { + final int myPss = memInfo.getOtherPss(i); + final int mySwappablePss = memInfo.getOtherSwappablePss(i); + final int mySharedDirty = memInfo.getOtherSharedDirty(i); + final int myPrivateDirty = memInfo.getOtherPrivateDirty(i); + final int mySharedClean = memInfo.getOtherSharedClean(i); + final int myPrivateClean = memInfo.getOtherPrivateClean(i); + final int mySwappedOut = memInfo.getOtherSwappedOut(i); + if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 + || mySharedClean != 0 || myPrivateClean != 0) { + if (dumpFullInfo) { + printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i), + myPss, mySwappablePss, mySharedDirty, myPrivateDirty, + mySharedClean, myPrivateClean, mySwappedOut, "", "", ""); + } else { + printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i), + myPss, myPrivateDirty, + myPrivateClean, mySwappedOut, "", "", ""); + } + } } } } + + pw.println(" "); + pw.println(" App Summary"); + printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "Pss(KB)"); + printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "------"); + printRow(pw, ONE_COUNT_COLUMN, + "Java Heap:", memInfo.getSummaryJavaHeap()); + printRow(pw, ONE_COUNT_COLUMN, + "Native Heap:", memInfo.getSummaryNativeHeap()); + printRow(pw, ONE_COUNT_COLUMN, + "Code:", memInfo.getSummaryCode()); + printRow(pw, ONE_COUNT_COLUMN, + "Stack:", memInfo.getSummaryStack()); + printRow(pw, ONE_COUNT_COLUMN, + "Graphics:", memInfo.getSummaryGraphics()); + printRow(pw, ONE_COUNT_COLUMN, + "Private Other:", memInfo.getSummaryPrivateOther()); + printRow(pw, ONE_COUNT_COLUMN, + "System:", memInfo.getSummarySystem()); + pw.println(" "); + printRow(pw, TWO_COUNT_COLUMNS, + "TOTAL:", memInfo.getSummaryTotalPss(), + "TOTAL SWAP (KB):", memInfo.getSummaryTotalSwap()); } public void registerOnActivityPausedListener(Activity activity, diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 5aa399b..7104185 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -606,7 +606,7 @@ public class AppOpsManager { UserManager.DISALLOW_CREATE_WINDOWS, //SYSTEM_ALERT_WINDOW null, //ACCESS_NOTIFICATIONS null, //CAMERA - null, //RECORD_AUDIO + UserManager.DISALLOW_RECORD_AUDIO, //RECORD_AUDIO null, //PLAY_AUDIO null, //READ_CLIPBOARD null, //WRITE_CLIPBOARD diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index b6989ab..1461380 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -529,10 +529,12 @@ public abstract class ApplicationThreadNative extends Binder boolean checkin = data.readInt() != 0; boolean dumpInfo = data.readInt() != 0; boolean dumpDalvik = data.readInt() != 0; + boolean dumpSummaryOnly = data.readInt() != 0; String[] args = data.readStringArray(); if (fd != null) { try { - dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo, dumpDalvik, args); + dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo, + dumpDalvik, dumpSummaryOnly, args); } finally { try { fd.close(); @@ -1248,7 +1250,7 @@ class ApplicationThreadProxy implements IApplicationThread { } public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, - boolean dumpInfo, boolean dumpDalvik, String[] args) throws RemoteException { + boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); @@ -1257,6 +1259,7 @@ class ApplicationThreadProxy implements IApplicationThread { data.writeInt(checkin ? 1 : 0); data.writeInt(dumpInfo ? 1 : 0); data.writeInt(dumpDalvik ? 1 : 0); + data.writeInt(dumpSummaryOnly ? 1 : 0); data.writeStringArray(args); mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0); reply.readException(); diff --git a/core/java/android/app/AssistStructure.java b/core/java/android/app/AssistStructure.java index 3abbb5b..a06bc31 100644 --- a/core/java/android/app/AssistStructure.java +++ b/core/java/android/app/AssistStructure.java @@ -35,6 +35,7 @@ import android.util.Log; import android.view.View; import android.view.ViewAssistStructure; import android.view.ViewRootImpl; +import android.view.WindowManager; import android.view.WindowManagerGlobal; import java.util.ArrayList; @@ -140,7 +141,14 @@ final public class AssistStructure implements Parcelable { mTitle = root.getTitle(); mRoot = new ViewNode(); ViewNodeBuilder builder = new ViewNodeBuilder(assist, mRoot, false); - view.dispatchProvideAssistStructure(builder); + if ((root.getWindowFlags()&WindowManager.LayoutParams.FLAG_SECURE) != 0) { + // This is a secure window, so it doesn't want a screenshot, and that + // means we should also not copy out its view hierarchy. + view.onProvideStructure(builder); + builder.setAssistBlocked(true); + return; + } + view.dispatchProvideStructure(builder); } WindowNode(Parcel in, PooledStringReader preader) { @@ -652,7 +660,7 @@ final public class AssistStructure implements Parcelable { } @Override - public Bundle editExtras() { + public Bundle getExtras() { if (mNode.mExtras != null) { return mNode.mExtras; } @@ -661,8 +669,8 @@ final public class AssistStructure implements Parcelable { } @Override - public void clearExtras() { - mNode.mExtras = null; + public boolean hasExtras() { + return mNode.mExtras != null; } @Override diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 81a78f6..cb20cb8 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -237,8 +237,11 @@ class ContextImpl extends Context { } @Override - public void setTheme(int resid) { - mThemeResource = resid; + public void setTheme(int resId) { + if (mThemeResource != resId) { + mThemeResource = resId; + initializeTheme(); + } } @Override @@ -248,13 +251,22 @@ class ContextImpl extends Context { @Override public Resources.Theme getTheme() { + if (mTheme != null) { + return mTheme; + } + + mThemeResource = Resources.selectDefaultTheme(mThemeResource, + getOuterContext().getApplicationInfo().targetSdkVersion); + initializeTheme(); + + return mTheme; + } + + private void initializeTheme() { if (mTheme == null) { - mThemeResource = Resources.selectDefaultTheme(mThemeResource, - getOuterContext().getApplicationInfo().targetSdkVersion); mTheme = mResources.newTheme(); - mTheme.applyStyle(mThemeResource, true); } - return mTheme; + mTheme.applyStyle(mThemeResource, true); } @Override diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 3fb82f6..185578f 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -131,7 +131,7 @@ public interface IApplicationThread extends IInterface { void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) throws RemoteException; void scheduleTrimMemory(int level) throws RemoteException; void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo, - boolean dumpDalvik, String[] args) throws RemoteException; + boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) throws RemoteException; void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException; void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException; void unstableProviderDied(IBinder provider) throws RemoteException; diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index ac8d5d8..63ff005 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -75,7 +75,7 @@ interface INotificationManager void requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter); int getInterruptionFilterFromListener(in INotificationListener token); void setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim); - NotificationManager.Policy.Token getPolicyTokenFromListener(in INotificationListener listener); + void setInterruptionFilter(String pkg, int interruptionFilter); ComponentName getEffectsSuppressor(); boolean matchesCallFilter(in Bundle extras); @@ -87,10 +87,13 @@ interface INotificationManager oneway void setZenMode(int mode, in Uri conditionId, String reason); oneway void notifyConditions(String pkg, in IConditionProvider provider, in Condition[] conditions); oneway void requestZenModeConditions(in IConditionListener callback, int relevance); - oneway void requestNotificationPolicyToken(String pkg, in INotificationManagerCallback callback); - boolean isNotificationPolicyTokenValid(String pkg, in NotificationManager.Policy.Token token); - NotificationManager.Policy getNotificationPolicy(in NotificationManager.Policy.Token token); - void setNotificationPolicy(in NotificationManager.Policy.Token token, in NotificationManager.Policy policy); + oneway void requestNotificationPolicyAccess(String pkg, in INotificationManagerCallback callback); + boolean isNotificationPolicyAccessGranted(String pkg); + NotificationManager.Policy getNotificationPolicy(String pkg); + void setNotificationPolicy(String pkg, in NotificationManager.Policy policy); + String[] getPackagesRequestingNotificationPolicyAccess(); + boolean isNotificationPolicyAccessGrantedForPackage(String pkg); + void setNotificationPolicyAccessGranted(String pkg, boolean granted); byte[] getBackupPayload(int user); void applyRestore(in byte[] payload, int user); diff --git a/core/java/android/app/INotificationManagerCallback.aidl b/core/java/android/app/INotificationManagerCallback.aidl index b9414ca..9929745 100644 --- a/core/java/android/app/INotificationManagerCallback.aidl +++ b/core/java/android/app/INotificationManagerCallback.aidl @@ -20,5 +20,5 @@ import android.app.NotificationManager; /** @hide */ oneway interface INotificationManagerCallback { - void onPolicyToken(in NotificationManager.Policy.Token token); + void onPolicyRequestResult(boolean granted); } diff --git a/core/java/android/app/NotificationManager.aidl b/core/java/android/app/NotificationManager.aidl index 8380b8d..a5d5671 100644 --- a/core/java/android/app/NotificationManager.aidl +++ b/core/java/android/app/NotificationManager.aidl @@ -17,4 +17,3 @@ package android.app; parcelable NotificationManager.Policy; -parcelable NotificationManager.Policy.Token;
\ No newline at end of file diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 0a59026..e4bbe27 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -20,7 +20,6 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; import android.app.Notification.Builder; -import android.app.NotificationManager.Policy.Token; import android.content.ComponentName; import android.content.Context; import android.content.pm.ParceledListSlice; @@ -38,6 +37,7 @@ import android.provider.Settings.Global; import android.service.notification.IConditionListener; import android.service.notification.StatusBarNotification; import android.service.notification.ZenModeConfig; +import android.util.ArraySet; import android.util.Log; import java.util.Objects; @@ -107,6 +107,43 @@ public class NotificationManager public static final String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED"; + /** + * Intent that is broadcast when the state of getCurrentInterruptionFilter() changes. + * This broadcast is only sent to registered receivers. + */ + @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_INTERRUPTION_FILTER_CHANGED + = "android.app.action.INTERRUPTION_FILTER_CHANGED"; + + /** + * {@link #getCurrentInterruptionFilter() Interruption filter} constant - + * Normal interruption filter. + */ + public static final int INTERRUPTION_FILTER_ALL = 1; + + /** + * {@link #getCurrentInterruptionFilter() Interruption filter} constant - + * Priority interruption filter. + */ + public static final int INTERRUPTION_FILTER_PRIORITY = 2; + + /** + * {@link #getCurrentInterruptionFilter() Interruption filter} constant - + * No interruptions filter. + */ + public static final int INTERRUPTION_FILTER_NONE = 3; + + /** + * {@link #getCurrentInterruptionFilter() Interruption filter} constant - + * Alarms only interruption filter. + */ + public static final int INTERRUPTION_FILTER_ALARMS = 4; + + /** {@link #getCurrentInterruptionFilter() Interruption filter} constant - returned when + * the value is unavailable for any reason. + */ + public static final int INTERRUPTION_FILTER_UNKNOWN = 0; + private static INotificationManager sService; /** @hide */ @@ -357,29 +394,29 @@ public class NotificationManager } /** - * Requests a notification policy token for the calling package. + * Requests the ability to read/modify notification policy for the calling package. * - * @param callback required, used to receive the granted token or the deny signal. + * @param callback required, used to receive the granted or the denied signal. * @param handler The handler used when receiving the result. * If null, the current thread is used. */ - public void requestNotificationPolicyToken(@NonNull final Policy.Token.RequestCallback callback, + public void requestPolicyAccess(@NonNull final NotificationPolicyAccessRequestCallback callback, @Nullable Handler handler) { checkRequired("callback", callback); final Handler h = handler != null ? handler : new Handler(); INotificationManager service = getService(); try { - service.requestNotificationPolicyToken(mContext.getOpPackageName(), + service.requestNotificationPolicyAccess(mContext.getOpPackageName(), new INotificationManagerCallback.Stub() { @Override - public void onPolicyToken(final Token token) throws RemoteException { + public void onPolicyRequestResult(final boolean granted) throws RemoteException { h.post(new Runnable() { @Override public void run() { - if (token != null) { - callback.onTokenGranted(token); + if (granted) { + callback.onAccessGranted(); } else { - callback.onTokenDenied(); + callback.onAccessDenied(); } } }); @@ -389,16 +426,38 @@ public class NotificationManager } } + /** Callback for receiving the result of a policy access request. */ + public static abstract class NotificationPolicyAccessRequestCallback { + /** + * Received if the request was granted for this package. + */ + public abstract void onAccessGranted(); + + /** + * Received if the request was denied for this package. + */ + public abstract void onAccessDenied(); + } + /** - * Checks a given notification policy token. + * Checks the ability to read/modify notification policy for the calling package. * - * Returns true if the token is still valid for managing policy. + * Returns true if the calling package can read/modify notification policy. */ - public boolean isNotificationPolicyTokenValid(@NonNull Policy.Token token) { - if (token == null) return false; + public boolean isNotificationPolicyAccessGranted() { INotificationManager service = getService(); try { - return service.isNotificationPolicyTokenValid(mContext.getOpPackageName(), token); + return service.isNotificationPolicyAccessGranted(mContext.getOpPackageName()); + } catch (RemoteException e) { + } + return false; + } + + /** @hide */ + public boolean isNotificationPolicyAccessGrantedForPackage(String pkg) { + INotificationManager service = getService(); + try { + return service.isNotificationPolicyAccessGrantedForPackage(pkg); } catch (RemoteException e) { } return false; @@ -407,13 +466,13 @@ public class NotificationManager /** * Gets the current notification policy. * - * @param token A valid notification policy token is required to access the current policy. + * <p> + * Only available if policy access is granted. */ - public Policy getNotificationPolicy(@NonNull Policy.Token token) { - checkRequired("token", token); + public Policy getNotificationPolicy() { INotificationManager service = getService(); try { - return service.getNotificationPolicy(token); + return service.getNotificationPolicy(mContext.getOpPackageName()); } catch (RemoteException e) { } return null; @@ -422,19 +481,46 @@ public class NotificationManager /** * Sets the current notification policy. * - * @param token A valid notification policy token is required to modify the current policy. + * <p> + * Only available if policy access is granted. + * * @param policy The new desired policy. */ - public void setNotificationPolicy(@NonNull Policy.Token token, @NonNull Policy policy) { - checkRequired("token", token); + public void setNotificationPolicy(@NonNull Policy policy) { checkRequired("policy", policy); INotificationManager service = getService(); try { - service.setNotificationPolicy(token, policy); + service.setNotificationPolicy(mContext.getOpPackageName(), policy); + } catch (RemoteException e) { + } + } + + /** @hide */ + public void setNotificationPolicyAccessGranted(String pkg, boolean granted) { + INotificationManager service = getService(); + try { + service.setNotificationPolicyAccessGranted(pkg, granted); } catch (RemoteException e) { } } + /** @hide */ + public ArraySet<String> getPackagesRequestingNotificationPolicyAccess() { + INotificationManager service = getService(); + try { + final String[] pkgs = service.getPackagesRequestingNotificationPolicyAccess(); + if (pkgs != null && pkgs.length > 0) { + final ArraySet<String> rt = new ArraySet<>(pkgs.length); + for (int i = 0; i < pkgs.length; i++) { + rt.add(pkgs[i]); + } + return rt; + } + } catch (RemoteException e) { + } + return new ArraySet<String>(); + } + private Context mContext; private static void checkRequired(String name, Object value) { @@ -477,24 +563,30 @@ public class NotificationManager /** Notification categories to prioritize. Bitmask of PRIORITY_CATEGORY_* constants. */ public final int priorityCategories; - /** Notification senders to prioritize. One of: + /** Notification senders to prioritize for calls. One of: + * PRIORITY_SENDERS_ANY, PRIORITY_SENDERS_CONTACTS, PRIORITY_SENDERS_STARRED */ + public final int priorityCallSenders; + + /** Notification senders to prioritize for messages. One of: * PRIORITY_SENDERS_ANY, PRIORITY_SENDERS_CONTACTS, PRIORITY_SENDERS_STARRED */ - public final int prioritySenders; + public final int priorityMessageSenders; - public Policy(int priorityCategories, int prioritySenders) { + public Policy(int priorityCategories, int priorityCallSenders, int priorityMessageSenders) { this.priorityCategories = priorityCategories; - this.prioritySenders = prioritySenders; + this.priorityCallSenders = priorityCallSenders; + this.priorityMessageSenders = priorityMessageSenders; } /** @hide */ public Policy(Parcel source) { - this(source.readInt(), source.readInt()); + this(source.readInt(), source.readInt(), source.readInt()); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(priorityCategories); - dest.writeInt(prioritySenders); + dest.writeInt(priorityCallSenders); + dest.writeInt(priorityMessageSenders); } @Override @@ -504,7 +596,7 @@ public class NotificationManager @Override public int hashCode() { - return Objects.hash(priorityCategories, prioritySenders); + return Objects.hash(priorityCategories, priorityCallSenders, priorityMessageSenders); } @Override @@ -513,14 +605,16 @@ public class NotificationManager if (o == this) return true; final Policy other = (Policy) o; return other.priorityCategories == priorityCategories - && other.prioritySenders == prioritySenders; + && other.priorityCallSenders == priorityCallSenders + && other.priorityMessageSenders == priorityMessageSenders; } @Override public String toString() { return "NotificationManager.Policy[" + "priorityCategories=" + priorityCategoriesToString(priorityCategories) - + ",prioritySenders=" + prioritySendersToString(prioritySenders) + + ",priorityCallSenders=" + prioritySendersToString(priorityCallSenders) + + ",priorityMessageSenders=" + prioritySendersToString(priorityMessageSenders) + "]"; } @@ -574,75 +668,6 @@ public class NotificationManager } }; - /** - * Represents a client-specific token required to manage notification policy. - */ - public static class Token implements Parcelable { - private final IBinder mBinder; - - /** @hide */ - public Token(IBinder binder) { - if (binder == null) throw new IllegalArgumentException("Binder required for token"); - mBinder = binder; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public int hashCode() { - return Objects.hash(mBinder); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Token)) return false; - if (o == this) return true; - final Token other = (Token) o; - return Objects.equals(other.mBinder, mBinder); - } - - @Override - public String toString() { - return String.format("NotificationManager.Token[0x%08x]", - System.identityHashCode(mBinder)); - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeStrongBinder(mBinder); - } - - public static final Parcelable.Creator<Token> CREATOR - = new Parcelable.Creator<Token>() { - @Override - public Token createFromParcel(Parcel in) { - return new Token(in.readStrongBinder()); - } - - @Override - public Token[] newArray(int size) { - return new Token[size]; - } - }; - - /** Callback for receiving the result of a token request. */ - public static abstract class RequestCallback { - /** - * Received if the request was granted for this package. - * - * @param token can be used to manage notification policy. - */ - public abstract void onTokenGranted(Policy.Token token); - - /** - * Received if the request was denied for this package. - */ - public abstract void onTokenDenied(); - } - } } /** @@ -671,4 +696,69 @@ public class NotificationManager } return new StatusBarNotification[0]; } + + /** + * Gets the current notification interruption filter. + * + * <p> + * The interruption filter defines which notifications are allowed to interrupt the user + * (e.g. via sound & vibration) and is applied globally. + * @return One of the INTERRUPTION_FILTER_ constants, or INTERRUPTION_FILTER_UNKNOWN when + * unavailable. + * + * <p> + * Only available if policy access is granted. + */ + public final int getCurrentInterruptionFilter() { + final INotificationManager service = getService(); + try { + return zenModeToInterruptionFilter(service.getZenMode()); + } catch (RemoteException e) { + Log.e(TAG, "Unable to talk to notification manager. Woe!", e); + } + return INTERRUPTION_FILTER_UNKNOWN; + } + + /** + * Sets the current notification interruption filter. + * + * <p> + * The interruption filter defines which notifications are allowed to interrupt the user + * (e.g. via sound & vibration) and is applied globally. + * @return One of the INTERRUPTION_FILTER_ constants, or INTERRUPTION_FILTER_UNKNOWN when + * unavailable. + * + * <p> + * Only available if policy access is granted. + */ + public final void setInterruptionFilter(int interruptionFilter) { + final INotificationManager service = getService(); + try { + service.setInterruptionFilter(mContext.getOpPackageName(), interruptionFilter); + } catch (RemoteException e) { + Log.e(TAG, "Unable to talk to notification manager. Woe!", e); + } + } + + /** @hide */ + public static int zenModeToInterruptionFilter(int zen) { + switch (zen) { + case Global.ZEN_MODE_OFF: return INTERRUPTION_FILTER_ALL; + case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: return INTERRUPTION_FILTER_PRIORITY; + case Global.ZEN_MODE_ALARMS: return INTERRUPTION_FILTER_ALARMS; + case Global.ZEN_MODE_NO_INTERRUPTIONS: return INTERRUPTION_FILTER_NONE; + default: return INTERRUPTION_FILTER_UNKNOWN; + } + } + + /** @hide */ + public static int zenModeFromInterruptionFilter(int interruptionFilter, int defValue) { + switch (interruptionFilter) { + case INTERRUPTION_FILTER_ALL: return Global.ZEN_MODE_OFF; + case INTERRUPTION_FILTER_PRIORITY: return Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; + case INTERRUPTION_FILTER_ALARMS: return Global.ZEN_MODE_ALARMS; + case INTERRUPTION_FILTER_NONE: return Global.ZEN_MODE_NO_INTERRUPTIONS; + default: return defValue; + } + } } diff --git a/core/java/android/app/admin/DeviceInitializerStatus.java b/core/java/android/app/admin/DeviceInitializerStatus.java index b58711c..7de518b 100644 --- a/core/java/android/app/admin/DeviceInitializerStatus.java +++ b/core/java/android/app/admin/DeviceInitializerStatus.java @@ -37,8 +37,8 @@ package android.app.admin; * <li>{@link #STATUS_ERROR_SET_DEVICE_POLICY} * <li>{@link #STATUS_ERROR_DELETE_APPS} * <li>{@link #STATUS_ERROR_DOUBLE_BUMP} - * <li>{@link #STATUS_STATE_CONNECT_BLUETOOTH_PROXY} - * <li>{@link #STATUS_STATE_DISCONNECT_BLUETOOTH_PROXY} + * <li>{@link #STATUS_STATE_CONNECTING_BLUETOOTH_PROXY} + * <li>{@link #STATUS_STATE_DISCONNECTING_BLUETOOTH_PROXY} * <li>{@link #STATUS_STATE_DEVICE_PROVISIONED} * </ul> */ @@ -84,13 +84,13 @@ public class DeviceInitializerStatus { * Device provisioning status code that indicates that a device is connecting to establish * a Bluetooth network proxy. */ - public static final int STATUS_STATE_CONNECT_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 8; + public static final int STATUS_STATE_CONNECTING_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 8; /** * Device provisioning status code that indicates that a connected Bluetooth network proxy * is being shut down. */ - public static final int STATUS_STATE_DISCONNECT_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 9; + public static final int STATUS_STATE_DISCONNECTING_BLUETOOTH_PROXY = FLAG_STATUS_HIGH_PRIORITY | 9; /** * Device provisioning status code that indicates that a device has been successfully @@ -141,37 +141,5 @@ public class DeviceInitializerStatus { */ public static final int STATUS_ERROR_DOUBLE_BUMP = FLAG_STATUS_ERROR | 30; - /** - * Determine if the specified status code represents an error status. - * @param statusCode status code to check - * @return {@code true} if the status code is an error status code - */ - public static boolean isErrorStatus(int statusCode) { - return isFlagSet(statusCode, FLAG_STATUS_ERROR); - } - - /** - * Determine if the specified status code is a custom status. Custom status codes are defined - * and sent by device initialization agents. - * @param statusCode status code to check - * @return {@code true} if the status code is a custom status code - */ - public static boolean isCustomStatus(int statusCode) { - return isFlagSet(statusCode, FLAG_STATUS_CUSTOM); - } - - /** - * Determine if the specified status code is a high priority status code. - * @param statusCode status code to check - * @return {@code true} if the status code is a high priority status code - */ - public static boolean isHighPriority(int statusCode) { - return isFlagSet(statusCode, FLAG_STATUS_HIGH_PRIORITY); - } - - private static boolean isFlagSet(int statusCode, int flag) { - return (statusCode & flag) != 0; - } - private DeviceInitializerStatus() {} } diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 8009b6c..ae07206 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -702,7 +702,7 @@ public class DevicePolicyManager { * reported to the remote setup device over Bluetooth. * * <p>Broadcasts with this action must supply a - * {@linkplain DeviceInitializerStatus#isCustomStatus(int) custom} status code in the + * {@linkplain DeviceInitializerStatus#FLAG_STATUS_CUSTOM custom} status code in the * {@link EXTRA_DEVICE_INITIALIZER_STATUS_CODE} extra. * * <p>Broadcasts may optionally contain a description in the @@ -718,7 +718,7 @@ public class DevicePolicyManager { * sent as part of a broadcast with an action of {@code ACTION_SEND_DEVICE_INITIALIZER_STATUS}. * * <p>The status code sent with this extra must be a custom status code as defined by - * {@link DeviceInitializerStatus#isCustomStatus(int)}. + * {@link DeviceInitializerStatus#FLAG_STATUS_CUSTOM}. * @hide */ @SystemApi @@ -1653,9 +1653,9 @@ public class DevicePolicyManager { } /** - * Queries whether {@link #DO_NOT_ASK_CREDENTIALS_ON_BOOT} flag is set. + * Queries whether {@link #RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT} flag is set. * - * @return true if DO_NOT_ASK_CREDENTIALS_ON_BOOT flag is set. + * @return true if RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT flag is set. * @hide */ public boolean getDoNotAskCredentialsOnBoot() { @@ -1753,7 +1753,7 @@ public class DevicePolicyManager { * is ignored. Once the flag is set, it cannot be reverted back without resetting the * device to factory defaults. */ - public static final int DO_NOT_ASK_CREDENTIALS_ON_BOOT = 0x0002; + public static final int RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT = 0x0002; /** * Force a new device unlock password (the password needed to access the @@ -1779,7 +1779,7 @@ public class DevicePolicyManager { * * @param password The new password for the user. Null or empty clears the password. * @param flags May be 0 or combination of {@link #RESET_PASSWORD_REQUIRE_ENTRY} and - * {@link #DO_NOT_ASK_CREDENTIALS_ON_BOOT}. + * {@link #RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT}. * @return Returns true if the password was applied, or false if it is * not acceptable for the current constraints. */ @@ -4229,7 +4229,7 @@ public class DevicePolicyManager { * Called by device initializer to send a provisioning status update to the remote setup device. * * @param statusCode a custom status code value as defined by - * {@link DeviceInitializerStatus#isCustomStatus(int)}. + * {@link DeviceInitializerStatus#FLAG_STATUS_CUSTOM}. * @param description custom description of the status code sent */ public void sendDeviceInitializerStatus(int statusCode, String description) { diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index d0298cd..6f543a8 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -2589,21 +2589,6 @@ public class Intent implements Parcelable, Cloneable { "android.intent.action.GET_RESTRICTION_ENTRIES"; /** - * @hide - * Activity to challenge the user for a PIN that was configured when setting up - * restrictions. Restrictions include blocking of apps and preventing certain user operations, - * controlled by {@link android.os.UserManager#setUserRestrictions(Bundle). - * Launch the activity using - * {@link android.app.Activity#startActivityForResult(Intent, int)} and check if the - * result is {@link android.app.Activity#RESULT_OK} for a successful response to the - * challenge.<p/> - * Before launching this activity, make sure that there is a PIN in effect, by calling - * {@link android.os.UserManager#hasRestrictionsChallenge()}. - */ - public static final String ACTION_RESTRICTIONS_CHALLENGE = - "android.intent.action.RESTRICTIONS_CHALLENGE"; - - /** * Sent the first time a user is starting, to allow system apps to * perform one time initialization. (This will not be seen by third * party applications because a newly initialized user does not have any diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 7ff6ec3..51fa075 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -1067,6 +1067,13 @@ public abstract class PackageManager { public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output"; /** + * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: + * The device has professional audio level of functionality, performance, and acoustics. + */ + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro"; + + /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device is capable of communicating with * other devices via Bluetooth. diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index e65b4ca..a572590 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -1804,8 +1804,8 @@ public class Resources { final int N = mKey.mCount; final String[] themes = new String[N * 2]; for (int i = 0, j = N - 1; i < themes.length; i += 2, --j) { - final int resId = mKey.mResId[i]; - final boolean forced = mKey.mForce[i]; + final int resId = mKey.mResId[j]; + final boolean forced = mKey.mForce[j]; try { themes[i] = getResourceName(resId); } catch (NotFoundException e) { @@ -1819,8 +1819,7 @@ public class Resources { /** @hide */ public void encode(@NonNull ViewHierarchyEncoder encoder) { encoder.beginObject(this); - // TODO: revert after getTheme() is fixed - String[] properties = new String[0]; // getTheme(); + final String[] properties = getTheme(); for (int i = 0; i < properties.length; i += 2) { encoder.addProperty(properties[i], properties[i+1]); } diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 36fc4f9..50eed3e 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -173,6 +173,27 @@ public class Build { "ro.build.version.sdk", 0); /** + * The developer preview revision of a prerelease SDK. This value will always + * be <code>0</code> on production platform builds/devices. + * + * <p>When this value is nonzero, any new API added since the last + * officially published {@link #SDK_INT API level} is only guaranteed to be present + * on that specific preview revision. For example, an API <code>Activity.fooBar()</code> + * might be present in preview revision 1 but renamed or removed entirely in + * preview revision 2, which may cause an app attempting to call it to crash + * at runtime.</p> + * + * <p>Experimental apps targeting preview APIs should check this value for + * equality (<code>==</code>) with the preview SDK revision they were built for + * before using any prerelease platform APIs. Apps that detect a preview SDK revision + * other than the specific one they expect should fall back to using APIs from + * the previously published API level only to avoid unwanted runtime exceptions. + * </p> + */ + public static final int PREVIEW_SDK_INT = SystemProperties.getInt( + "ro.build.version.preview_sdk", 0); + + /** * The current development codename, or the string "REL" if this is * a release build. */ diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index 4aff7a1..19c8fa9 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -169,6 +169,65 @@ public final class Debug public int otherSwappedOut; /** @hide */ + public static final int HEAP_UNKNOWN = 0; + /** @hide */ + public static final int HEAP_DALVIK = 1; + /** @hide */ + public static final int HEAP_NATIVE = 2; + + /** @hide */ + public static final int OTHER_DALVIK_OTHER = 0; + /** @hide */ + public static final int OTHER_STACK = 1; + /** @hide */ + public static final int OTHER_CURSOR = 2; + /** @hide */ + public static final int OTHER_ASHMEM = 3; + /** @hide */ + public static final int OTHER_GL_DEV = 4; + /** @hide */ + public static final int OTHER_UNKNOWN_DEV = 5; + /** @hide */ + public static final int OTHER_SO = 6; + /** @hide */ + public static final int OTHER_JAR = 7; + /** @hide */ + public static final int OTHER_APK = 8; + /** @hide */ + public static final int OTHER_TTF = 9; + /** @hide */ + public static final int OTHER_DEX = 10; + /** @hide */ + public static final int OTHER_OAT = 11; + /** @hide */ + public static final int OTHER_ART = 12; + /** @hide */ + public static final int OTHER_UNKNOWN_MAP = 13; + /** @hide */ + public static final int OTHER_GRAPHICS = 14; + /** @hide */ + public static final int OTHER_GL = 15; + /** @hide */ + public static final int OTHER_OTHER_MEMTRACK = 16; + + /** @hide */ + public static final int OTHER_DALVIK_NORMAL = 17; + /** @hide */ + public static final int OTHER_DALVIK_LARGE = 18; + /** @hide */ + public static final int OTHER_DALVIK_LINEARALLOC = 19; + /** @hide */ + public static final int OTHER_DALVIK_ACCOUNTING = 20; + /** @hide */ + public static final int OTHER_DALVIK_CODE_CACHE = 21; + /** @hide */ + public static final int OTHER_DALVIK_ZYGOTE = 22; + /** @hide */ + public static final int OTHER_DALVIK_NON_MOVING = 23; + /** @hide */ + public static final int OTHER_DALVIK_INDIRECT_REFERENCE_TABLE = 24; + + /** @hide */ public static final int NUM_OTHER_STATS = 17; /** @hide */ @@ -284,6 +343,11 @@ public final class Debug } /** @hide */ + public int getOtherPrivate(int which) { + return getOtherPrivateClean(which) + getOtherPrivateDirty(which); + } + + /** @hide */ public int getOtherSharedClean(int which) { return otherStats[which*NUM_CATEGORIES + offsetSharedClean]; } @@ -296,35 +360,157 @@ public final class Debug /** @hide */ public static String getOtherLabel(int which) { switch (which) { - case 0: return "Dalvik Other"; - case 1: return "Stack"; - case 2: return "Cursor"; - case 3: return "Ashmem"; - case 4: return "Gfx dev"; - case 5: return "Other dev"; - case 6: return ".so mmap"; - case 7: return ".jar mmap"; - case 8: return ".apk mmap"; - case 9: return ".ttf mmap"; - case 10: return ".dex mmap"; - case 11: return ".oat mmap"; - case 12: return ".art mmap"; - case 13: return "Other mmap"; - case 14: return "EGL mtrack"; - case 15: return "GL mtrack"; - case 16: return "Other mtrack"; - case 17: return ".Heap"; - case 18: return ".LOS"; - case 19: return ".LinearAlloc"; - case 20: return ".GC"; - case 21: return ".JITCache"; - case 22: return ".Zygote"; - case 23: return ".NonMoving"; - case 24: return ".IndirectRef"; + case OTHER_DALVIK_OTHER: return "Dalvik Other"; + case OTHER_STACK: return "Stack"; + case OTHER_CURSOR: return "Cursor"; + case OTHER_ASHMEM: return "Ashmem"; + case OTHER_GL_DEV: return "Gfx dev"; + case OTHER_UNKNOWN_DEV: return "Other dev"; + case OTHER_SO: return ".so mmap"; + case OTHER_JAR: return ".jar mmap"; + case OTHER_APK: return ".apk mmap"; + case OTHER_TTF: return ".ttf mmap"; + case OTHER_DEX: return ".dex mmap"; + case OTHER_OAT: return ".oat mmap"; + case OTHER_ART: return ".art mmap"; + case OTHER_UNKNOWN_MAP: return "Other mmap"; + case OTHER_GRAPHICS: return "EGL mtrack"; + case OTHER_GL: return "GL mtrack"; + case OTHER_OTHER_MEMTRACK: return "Other mtrack"; + case OTHER_DALVIK_NORMAL: return ".Heap"; + case OTHER_DALVIK_LARGE: return ".LOS"; + case OTHER_DALVIK_LINEARALLOC: return ".LinearAlloc"; + case OTHER_DALVIK_ACCOUNTING: return ".GC"; + case OTHER_DALVIK_CODE_CACHE: return ".JITCache"; + case OTHER_DALVIK_ZYGOTE: return ".Zygote"; + case OTHER_DALVIK_NON_MOVING: return ".NonMoving"; + case OTHER_DALVIK_INDIRECT_REFERENCE_TABLE: return ".IndirectRef"; default: return "????"; } } + /** + * Pss of Java Heap bytes in KB due to the application. + * Notes: + * * OTHER_ART is the boot image. Anything private here is blamed on + * the application, not the system. + * * dalvikPrivateDirty includes private zygote, which means the + * application dirtied something allocated by the zygote. We blame + * the application for that memory, not the system. + * * Does not include OTHER_DALVIK_OTHER, which is considered VM + * Overhead and lumped into Private Other. + * * We don't include dalvikPrivateClean, because there should be no + * such thing as private clean for the Java Heap. + * @hide + */ + public int getSummaryJavaHeap() { + return dalvikPrivateDirty + getOtherPrivate(OTHER_ART); + } + + /** + * Pss of Native Heap bytes in KB due to the application. + * Notes: + * * Includes private dirty malloc space. + * * We don't include nativePrivateClean, because there should be no + * such thing as private clean for the Native Heap. + * @hide + */ + public int getSummaryNativeHeap() { + return nativePrivateDirty; + } + + /** + * Pss of code and other static resource bytes in KB due to + * the application. + * @hide + */ + public int getSummaryCode() { + return getOtherPrivate(OTHER_SO) + + getOtherPrivate(OTHER_JAR) + + getOtherPrivate(OTHER_APK) + + getOtherPrivate(OTHER_TTF) + + getOtherPrivate(OTHER_DEX) + + getOtherPrivate(OTHER_OAT); + } + + /** + * Pss in KB of the stack due to the application. + * Notes: + * * Includes private dirty stack, which includes both Java and Native + * stack. + * * Does not include private clean stack, because there should be no + * such thing as private clean for the stack. + * @hide + */ + public int getSummaryStack() { + return getOtherPrivateDirty(OTHER_STACK); + } + + /** + * Pss in KB of graphics due to the application. + * Notes: + * * Includes private Gfx, EGL, and GL. + * * Warning: These numbers can be misreported by the graphics drivers. + * * We don't include shared graphics. It may make sense to, because + * shared graphics are likely buffers due to the application + * anyway, but it's simpler to implement to just group all shared + * memory into the System category. + * @hide + */ + public int getSummaryGraphics() { + return getOtherPrivate(OTHER_GL_DEV) + + getOtherPrivate(OTHER_GRAPHICS) + + getOtherPrivate(OTHER_GL); + } + + /** + * Pss in KB due to the application that haven't otherwise been + * accounted for. + * @hide + */ + public int getSummaryPrivateOther() { + return getTotalPrivateClean() + + getTotalPrivateDirty() + - getSummaryJavaHeap() + - getSummaryNativeHeap() + - getSummaryCode() + - getSummaryStack() + - getSummaryGraphics(); + } + + /** + * Pss in KB due to the system. + * Notes: + * * Includes all shared memory. + * @hide + */ + public int getSummarySystem() { + return getTotalPss() + - getTotalPrivateClean() + - getTotalPrivateDirty(); + } + + /** + * Total Pss in KB. + * @hide + */ + public int getSummaryTotalPss() { + return getTotalPss(); + } + + /** + * Total Swap in KB. + * Notes: + * * Some of this memory belongs in other categories, but we don't + * know if the Swap memory is shared or private, so we don't know + * what to blame on the application and what on the system. + * For now, just lump all the Swap in one place. + * @hide + */ + public int getSummaryTotalSwap() { + return getTotalSwappedOut(); + } + public int describeContents() { return 0; } diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl index c2fd3c3..f212daf 100644 --- a/core/java/android/os/IUserManager.aidl +++ b/core/java/android/os/IUserManager.aidl @@ -45,13 +45,12 @@ interface IUserManager { Bundle getUserRestrictions(int userHandle); boolean hasUserRestriction(in String restrictionKey, int userHandle); void setUserRestrictions(in Bundle restrictions, int userHandle); + void setUserRestriction(String key, boolean value, int userId); + void setSystemControlledUserRestriction(String key, boolean value, int userId); void setApplicationRestrictions(in String packageName, in Bundle restrictions, int userHandle); Bundle getApplicationRestrictions(in String packageName); Bundle getApplicationRestrictionsForUser(in String packageName, int userHandle); - boolean setRestrictionsChallenge(in String newPin); - int checkRestrictionsChallenge(in String pin); - boolean hasRestrictionsChallenge(); void removeRestrictions(); void setDefaultGuestRestrictions(in Bundle restrictions); Bundle getDefaultGuestRestrictions(); diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 44eb1ed..cc37d5e 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -412,6 +412,16 @@ public class UserManager { public static final String DISALLOW_SAFE_BOOT = "no_safe_boot"; /** + * Specifies if a user is not allowed to record audio. This restriction is always enabled for + * background users. The default value is <code>false</code>. + * + * @see #setUserRestrictions(Bundle) + * @see #getUserRestrictions() + * @hide + */ + public static final String DISALLOW_RECORD_AUDIO = "no_record_audio"; + + /** * Application restriction key that is used to indicate the pending arrival * of real restrictions for the app. * @@ -688,9 +698,11 @@ public class UserManager { */ @Deprecated public void setUserRestriction(String key, boolean value, UserHandle userHandle) { - Bundle bundle = getUserRestrictions(userHandle); - bundle.putBoolean(key, value); - setUserRestrictions(bundle, userHandle); + try { + mService.setUserRestriction(key, value, userHandle.getIdentifier()); + } catch (RemoteException re) { + Log.w(TAG, "Could not set user restriction", re); + } } /** @@ -744,7 +756,7 @@ public class UserManager { * @see #getSerialNumberForUser(UserHandle) */ public UserHandle getUserForSerialNumber(long serialNumber) { - int ident = getUserHandle((int)serialNumber); + int ident = getUserHandle((int) serialNumber); return ident >= 0 ? new UserHandle(ident) : null; } @@ -1252,49 +1264,10 @@ public class UserManager { * apps and requires the MANAGE_USERS permission. * @param newPin the PIN to use for challenge dialogs. * @return Returns true if the challenge PIN was set successfully. + * @deprecated The restrictions PIN functionality is no longer provided by the system. + * This method is preserved for backwards compatibility reasons and always returns false. */ public boolean setRestrictionsChallenge(String newPin) { - try { - return mService.setRestrictionsChallenge(newPin); - } catch (RemoteException re) { - Log.w(TAG, "Could not change restrictions pin"); - } - return false; - } - - /** - * @hide - * @param pin The PIN to verify, or null to get the number of milliseconds to wait for before - * allowing the user to enter the PIN. - * @return Returns a positive number (including zero) for how many milliseconds before - * you can accept another PIN, when the input is null or the input doesn't match the saved PIN. - * Returns {@link #PIN_VERIFICATION_SUCCESS} if the input matches the saved PIN. Returns - * {@link #PIN_VERIFICATION_FAILED_NOT_SET} if there is no PIN set. - */ - public int checkRestrictionsChallenge(String pin) { - try { - return mService.checkRestrictionsChallenge(pin); - } catch (RemoteException re) { - Log.w(TAG, "Could not check restrictions pin"); - } - return PIN_VERIFICATION_FAILED_INCORRECT; - } - - /** - * @hide - * Checks whether the user has restrictions that are PIN-protected. An application that - * participates in restrictions can check if the owner has requested a PIN challenge for - * any restricted operations. If there is a PIN in effect, the application should launch - * the PIN challenge activity {@link android.content.Intent#ACTION_RESTRICTIONS_CHALLENGE}. - * @see android.content.Intent#ACTION_RESTRICTIONS_CHALLENGE - * @return whether a restrictions PIN is in effect. - */ - public boolean hasRestrictionsChallenge() { - try { - return mService.hasRestrictionsChallenge(); - } catch (RemoteException re) { - Log.w(TAG, "Could not change restrictions pin"); - } return false; } diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 7c3c11b..dc70d7b 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -809,6 +809,18 @@ public final class Settings { = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"; /** + * Activity Action: Show Do Not Disturb access settings. + * <p> + * In some cases, a matching Activity may not exist, so ensure you safeguard against this. + * <p> + * Input: Nothing. + * <p> + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_ZEN_ACCESS_SETTINGS = "android.settings.ZEN_ACCESS_SETTINGS"; + + /** * @hide */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) diff --git a/core/java/android/security/IKeystoreService.aidl b/core/java/android/security/IKeystoreService.aidl index 579cdbe..4809050 100644 --- a/core/java/android/security/IKeystoreService.aidl +++ b/core/java/android/security/IKeystoreService.aidl @@ -37,9 +37,9 @@ interface IKeystoreService { int exist(String name, int uid); String[] saw(String namePrefix, int uid); int reset(); - int password(String password); + int onUserPasswordChanged(int userId, String newPassword); int lock(); - int unlock(String password); + int unlock(int userId, String userPassword); int zero(); int generate(String name, int uid, int keyType, int keySize, int flags, in KeystoreArguments args); diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 35b8819..7956a3f 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -21,7 +21,7 @@ import android.annotation.SdkConstant; import android.app.INotificationManager; import android.app.Notification; import android.app.Notification.Builder; -import android.app.NotificationManager.Policy; +import android.app.NotificationManager; import android.app.Service; import android.content.ComponentName; import android.content.Context; @@ -64,25 +64,29 @@ public abstract class NotificationListenerService extends Service { * {@link #getCurrentInterruptionFilter() Interruption filter} constant - * Normal interruption filter. */ - public static final int INTERRUPTION_FILTER_ALL = 1; + public static final int INTERRUPTION_FILTER_ALL + = NotificationManager.INTERRUPTION_FILTER_ALL; /** * {@link #getCurrentInterruptionFilter() Interruption filter} constant - * Priority interruption filter. */ - public static final int INTERRUPTION_FILTER_PRIORITY = 2; + public static final int INTERRUPTION_FILTER_PRIORITY + = NotificationManager.INTERRUPTION_FILTER_PRIORITY; /** * {@link #getCurrentInterruptionFilter() Interruption filter} constant - * No interruptions filter. */ - public static final int INTERRUPTION_FILTER_NONE = 3; + public static final int INTERRUPTION_FILTER_NONE + = NotificationManager.INTERRUPTION_FILTER_NONE; /** * {@link #getCurrentInterruptionFilter() Interruption filter} constant - * Alarms only interruption filter. */ - public static final int INTERRUPTION_FILTER_ALARMS = 4; + public static final int INTERRUPTION_FILTER_ALARMS + = NotificationManager.INTERRUPTION_FILTER_ALARMS; /** {@link #getCurrentInterruptionFilter() Interruption filter} constant - returned when * the value is unavailable for any reason. For example, before the notification listener @@ -90,7 +94,8 @@ public abstract class NotificationListenerService extends Service { * * {@see #onListenerConnected()} */ - public static final int INTERRUPTION_FILTER_UNKNOWN = 0; + public static final int INTERRUPTION_FILTER_UNKNOWN + = NotificationManager.INTERRUPTION_FILTER_UNKNOWN; /** {@link #getCurrentListenerHints() Listener hints} constant - the primary device UI * should disable notification sound, vibrating and other visual or aural effects. @@ -516,22 +521,6 @@ public abstract class NotificationListenerService extends Service { } /** - * Gets the notification policy token associated with this listener. - * - * <p> - * Returns null if this listener is not currently active. - */ - public final Policy.Token getNotificationPolicyToken() { - if (!isBound()) return null; - try { - return getNotificationInterface().getPolicyTokenFromListener(mWrapper); - } catch (android.os.RemoteException ex) { - Log.v(TAG, "Unable to contact notification manager", ex); - return null; - } - } - - /** * Sets the desired {@link #getCurrentListenerHints() listener hints}. * * <p> diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java index 26bd10f..599ac74 100644 --- a/core/java/android/service/notification/ZenModeConfig.java +++ b/core/java/android/service/notification/ZenModeConfig.java @@ -538,7 +538,7 @@ public class ZenModeConfig implements Parcelable { } priorityCallSenders = sourceToPrioritySenders(allowCallsFrom, priorityCallSenders); priorityMessageSenders = sourceToPrioritySenders(allowMessagesFrom, priorityMessageSenders); - return new Policy(priorityCategories, priorityCallSenders); + return new Policy(priorityCategories, priorityCallSenders, priorityMessageSenders); } private static int sourceToPrioritySenders(int source, int def) { @@ -567,7 +567,9 @@ public class ZenModeConfig implements Parcelable { allowReminders = (policy.priorityCategories & Policy.PRIORITY_CATEGORY_REMINDERS) != 0; allowRepeatCallers = (policy.priorityCategories & Policy.PRIORITY_CATEGORY_REPEAT_CALLERS) != 0; - allowCallsFrom = prioritySendersToSource(policy.prioritySenders, allowCallsFrom); + allowCallsFrom = prioritySendersToSource(policy.priorityCallSenders, allowCallsFrom); + allowMessagesFrom = prioritySendersToSource(policy.priorityMessageSenders, + allowMessagesFrom); } public static Condition toTimeCondition(Context context, int minutesFromNow, int userHandle) { @@ -733,17 +735,20 @@ public class ZenModeConfig implements Parcelable { && conditionId.getPathSegments().get(0).equals(EVENT_PATH); if (!isEvent) return null; final EventInfo rt = new EventInfo(); - rt.calendar = tryParseLong(conditionId.getQueryParameter("calendar"), 0L); + rt.calendar = tryParseLong(conditionId.getQueryParameter("calendar"), + EventInfo.ANY_CALENDAR); rt.reply = tryParseInt(conditionId.getQueryParameter("reply"), 0); return rt; } public static class EventInfo { + public static final long ANY_CALENDAR = 0; + public static final int REPLY_ANY_EXCEPT_NO = 0; public static final int REPLY_YES_OR_MAYBE = 1; public static final int REPLY_YES = 2; - public long calendar; // CalendarContract.Calendars._ID, or 0 for any + public long calendar = ANY_CALENDAR; // CalendarContract.Calendars._ID, or ANY_CALENDAR public int reply; @Override diff --git a/core/java/android/view/ContextThemeWrapper.java b/core/java/android/view/ContextThemeWrapper.java index 9047b1d..ce50091 100644 --- a/core/java/android/view/ContextThemeWrapper.java +++ b/core/java/android/view/ContextThemeWrapper.java @@ -87,9 +87,12 @@ public class ContextThemeWrapper extends ContextWrapper { } } - @Override public void setTheme(int resid) { - mThemeResource = resid; - initializeTheme(); + @Override + public void setTheme(int resid) { + if (mThemeResource != resid) { + mThemeResource = resid; + initializeTheme(); + } } /** @hide */ diff --git a/core/java/android/view/GhostView.java b/core/java/android/view/GhostView.java index 9f46f45..41502b6 100644 --- a/core/java/android/view/GhostView.java +++ b/core/java/android/view/GhostView.java @@ -82,8 +82,7 @@ public class GhostView extends View { mView.mGhostView = null; final ViewGroup parent = (ViewGroup) mView.getParent(); if (parent != null) { - parent.mRecreateDisplayList = true; - parent.updateDisplayListIfDirty(); + parent.invalidate(); } } } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a3d0b2a..e1f1816 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -633,7 +633,6 @@ import java.util.concurrent.atomic.AtomicInteger; * </p> * * @attr ref android.R.styleable#View_alpha - * @attr ref android.R.styleable#View_assistBlocked * @attr ref android.R.styleable#View_background * @attr ref android.R.styleable#View_clickable * @attr ref android.R.styleable#View_contentDescription @@ -2533,7 +2532,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, PFLAG3_SCROLL_INDICATOR_END >> SCROLL_INDICATORS_TO_PFLAGS3_LSHIFT; /** - * <p>Indicates that we are allowing {@link android.view.ViewAssistStructure} to traverse + * <p>Indicates that we are allowing {@link ViewStructure} to traverse * into this view.<p> */ static final int PFLAG3_ASSIST_BLOCKED = 0x100; @@ -4050,11 +4049,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, viewFlagMasks |= SAVE_DISABLED_MASK; } break; - case com.android.internal.R.styleable.View_assistBlocked: - if (a.getBoolean(attr, false)) { - mPrivateFlags3 |= PFLAG3_ASSIST_BLOCKED; - } - break; case com.android.internal.R.styleable.View_duplicateParentState: if (a.getBoolean(attr, false)) { viewFlagValues |= DUPLICATE_PARENT_STATE; @@ -6163,7 +6157,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param structure Fill in with structured view data. The default implementation * fills in all data that can be inferred from the view itself. */ - public void onProvideAssistStructure(ViewAssistStructure structure) { + public void onProvideStructure(ViewStructure structure) { final int id = mID; if (id > 0 && (id&0xff000000) != 0 && (id&0x00ff0000) != 0 && (id&0x0000ffff) != 0) { @@ -6217,6 +6211,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, structure.setContentDescription(getContentDescription()); } + /** @hide */ + public void onProvideAssistStructure(ViewStructure structure) { + onProvideStructure(structure); + } + /** * Called when assist structure is being retrieved from a view as part of * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData} to @@ -6225,19 +6224,24 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * view's virtual accessibility nodes, if any. You can override this for a more * optimal implementation providing this data. */ - public void onProvideVirtualAssistStructure(ViewAssistStructure structure) { + public void onProvideVirtualStructure(ViewStructure structure) { AccessibilityNodeProvider provider = getAccessibilityNodeProvider(); if (provider != null) { AccessibilityNodeInfo info = createAccessibilityNodeInfo(); Log.i("View", "Provider of " + this + ": children=" + info.getChildCount()); structure.setChildCount(1); - ViewAssistStructure root = structure.newChild(0); - populateVirtualAssistStructure(root, provider, info); + ViewStructure root = structure.newChild(0); + populateVirtualStructure(root, provider, info); info.recycle(); } } - private void populateVirtualAssistStructure(ViewAssistStructure structure, + /** @hide */ + public void onProvideVirtualAssistStructure(ViewStructure structure) { + onProvideVirtualStructure(structure); + } + + private void populateVirtualStructure(ViewStructure structure, AccessibilityNodeProvider provider, AccessibilityNodeInfo info) { structure.setId(AccessibilityNodeInfo.getVirtualDescendantId(info.getSourceNodeId()), null, null, null); @@ -6288,19 +6292,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, for (int i=0; i<NCHILDREN; i++) { AccessibilityNodeInfo cinfo = provider.createAccessibilityNodeInfo( AccessibilityNodeInfo.getVirtualDescendantId(info.getChildId(i))); - ViewAssistStructure child = structure.newChild(i); - populateVirtualAssistStructure(child, provider, cinfo); + ViewStructure child = structure.newChild(i); + populateVirtualStructure(child, provider, cinfo); cinfo.recycle(); } } } /** - * Dispatch creation of {@link ViewAssistStructure} down the hierarchy. The default - * implementation calls {@link #onProvideAssistStructure} and - * {@link #onProvideVirtualAssistStructure}. + * Dispatch creation of {@link ViewStructure} down the hierarchy. The default + * implementation calls {@link #onProvideStructure} and + * {@link #onProvideVirtualStructure}. */ - public void dispatchProvideAssistStructure(ViewAssistStructure structure) { + public void dispatchProvideStructure(ViewStructure structure) { if (!isAssistBlocked()) { onProvideAssistStructure(structure); onProvideVirtualAssistStructure(structure); @@ -7904,8 +7908,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * @hide * Indicates whether this view will participate in data collection through - * {@link android.view.ViewAssistStructure}. If true, it will not provide any data + * {@link ViewStructure}. If true, it will not provide any data * for itself or its children. If false, the normal data collection will be allowed. * * @return Returns false if assist data collection is not blocked, else true. @@ -7918,17 +7923,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * @hide * Controls whether assist data collection from this view and its children is enabled - * (that is, whether {@link #onProvideAssistStructure} and - * {@link #onProvideVirtualAssistStructure} will be called). The default value is false, + * (that is, whether {@link #onProvideStructure} and + * {@link #onProvideVirtualStructure} will be called). The default value is false, * allowing normal assist collection. Setting this to false will disable assist collection. * * @param enabled Set to true to <em>disable</em> assist data collection, or false * (the default) to allow it. * * @see #isAssistBlocked() - * @see #onProvideAssistStructure - * @see #onProvideVirtualAssistStructure + * @see #onProvideStructure + * @see #onProvideVirtualStructure * @attr ref android.R.styleable#View_assistBlocked */ public void setAssistBlocked(boolean enabled) { diff --git a/core/java/android/view/ViewAssistStructure.java b/core/java/android/view/ViewAssistStructure.java index fccfbb8..a66d93c 100644 --- a/core/java/android/view/ViewAssistStructure.java +++ b/core/java/android/view/ViewAssistStructure.java @@ -16,70 +16,9 @@ package android.view; -import android.graphics.Rect; -import android.os.Bundle; -import android.text.TextPaint; - /** - * Container for storing additional per-view data generated by {@link View#onProvideAssistStructure - * View.onProvideAssistStructure}. + * @deprecated Temporary until old apps can move off this. */ -public abstract class ViewAssistStructure { - public abstract void setId(int id, String packageName, String typeName, String entryName); - - public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width, - int height); - - public abstract void setVisibility(int visibility); - - public abstract void setAssistBlocked(boolean state); - - public abstract void setEnabled(boolean state); - - public abstract void setClickable(boolean state); - - public abstract void setLongClickable(boolean state); - - public abstract void setStylusButtonPressable(boolean state); - - public abstract void setFocusable(boolean state); - - public abstract void setFocused(boolean state); - - public abstract void setAccessibilityFocused(boolean state); - - public abstract void setCheckable(boolean state); - - public abstract void setChecked(boolean state); - - public abstract void setSelected(boolean state); - - public abstract void setActivated(boolean state); - - public abstract void setClassName(String className); - - public abstract void setContentDescription(CharSequence contentDescription); - - public abstract void setText(CharSequence text); - public abstract void setText(CharSequence text, int selectionStart, int selectionEnd); - public abstract void setTextPaint(TextPaint paint); - public abstract void setHint(CharSequence hint); - - public abstract CharSequence getText(); - public abstract int getTextSelectionStart(); - public abstract int getTextSelectionEnd(); - public abstract CharSequence getHint(); - - public abstract Bundle editExtras(); - public abstract void clearExtras(); - - public abstract void setChildCount(int num); - public abstract int getChildCount(); - public abstract ViewAssistStructure newChild(int index); - - public abstract ViewAssistStructure asyncNewChild(int index); - public abstract void asyncCommit(); - - /** @hide */ - public abstract Rect getTempRect(); +@Deprecated +public abstract class ViewAssistStructure extends ViewStructure { } diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index d0738b0..51c4760 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2878,12 +2878,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } /** - * Dispatch creation of {@link ViewAssistStructure} down the hierarchy. This implementation + * Dispatch creation of {@link ViewStructure} down the hierarchy. This implementation * adds in all child views of the view group, in addition to calling the default View * implementation. */ - public void dispatchProvideAssistStructure(ViewAssistStructure structure) { - super.dispatchProvideAssistStructure(structure); + public void dispatchProvideStructure(ViewStructure structure) { + super.dispatchProvideStructure(structure); if (!isAssistBlocked()) { if (structure.getChildCount() == 0) { final int childrenCount = getChildCount(); @@ -2898,8 +2898,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager ? getChildDrawingOrder(childrenCount, i) : i; final View child = (preorderedList == null) ? children[childIndex] : preorderedList.get(childIndex); - ViewAssistStructure cstructure = structure.newChild(i); - child.dispatchProvideAssistStructure(cstructure); + ViewStructure cstructure = structure.newChild(i); + child.dispatchProvideStructure(cstructure); } } } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index c9c2a82..ea1dadb 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -654,6 +654,10 @@ public final class ViewRootImpl implements ViewParent, return (mWindowAttributes.flags & WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE) != 0; } + public int getWindowFlags() { + return mWindowAttributes.flags; + } + public CharSequence getTitle() { return mWindowAttributes.getTitle(); } diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java new file mode 100644 index 0000000..8dc49ac --- /dev/null +++ b/core/java/android/view/ViewStructure.java @@ -0,0 +1,86 @@ +/* + * 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.view; + +import android.graphics.Rect; +import android.os.Bundle; +import android.text.TextPaint; + +/** + * Container for storing additional per-view data generated by {@link View#onProvideStructure + * View.onProvideStructure}. + */ +public abstract class ViewStructure { + public abstract void setId(int id, String packageName, String typeName, String entryName); + + public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width, + int height); + + public abstract void setVisibility(int visibility); + + /** @hide */ + public abstract void setAssistBlocked(boolean state); + + public abstract void setEnabled(boolean state); + + public abstract void setClickable(boolean state); + + public abstract void setLongClickable(boolean state); + + public abstract void setStylusButtonPressable(boolean state); + + public abstract void setFocusable(boolean state); + + public abstract void setFocused(boolean state); + + public abstract void setAccessibilityFocused(boolean state); + + public abstract void setCheckable(boolean state); + + public abstract void setChecked(boolean state); + + public abstract void setSelected(boolean state); + + public abstract void setActivated(boolean state); + + public abstract void setClassName(String className); + + public abstract void setContentDescription(CharSequence contentDescription); + + public abstract void setText(CharSequence text); + public abstract void setText(CharSequence text, int selectionStart, int selectionEnd); + public abstract void setTextPaint(TextPaint paint); + public abstract void setHint(CharSequence hint); + + public abstract CharSequence getText(); + public abstract int getTextSelectionStart(); + public abstract int getTextSelectionEnd(); + public abstract CharSequence getHint(); + + public abstract Bundle getExtras(); + public abstract boolean hasExtras(); + + public abstract void setChildCount(int num); + public abstract int getChildCount(); + public abstract ViewAssistStructure newChild(int index); + + public abstract ViewAssistStructure asyncNewChild(int index); + public abstract void asyncCommit(); + + /** @hide */ + public abstract Rect getTempRect(); +} diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index a261aaf..e27e253 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -41,7 +41,7 @@ import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; -import android.view.ViewAssistStructure; +import android.view.ViewStructure; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ViewHierarchyEncoder; @@ -2428,7 +2428,7 @@ public class WebView extends AbsoluteLayout } @Override - public void onProvideVirtualAssistStructure(ViewAssistStructure structure) { + public void onProvideVirtualStructure(ViewStructure structure) { mProvider.getViewDelegate().onProvideVirtualAssistStructure(structure); } diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java index d5787de..e367192 100644 --- a/core/java/android/webkit/WebViewProvider.java +++ b/core/java/android/webkit/WebViewProvider.java @@ -32,7 +32,7 @@ import android.print.PrintDocumentAdapter; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; -import android.view.ViewAssistStructure; +import android.view.ViewStructure; import android.view.ViewGroup.LayoutParams; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; @@ -299,7 +299,7 @@ public interface WebViewProvider { interface ViewDelegate { public boolean shouldDelayChildPressedState(); - public void onProvideVirtualAssistStructure(ViewAssistStructure structure); + public void onProvideVirtualAssistStructure(ViewStructure structure); public AccessibilityNodeProvider getAccessibilityNodeProvider(); diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index bd41435..4fd85b6 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -3974,16 +3974,16 @@ public class Editor { } } mTouchWordOffset = Math.max(trueOffset - offset, 0); - mInWord = !getWordIteratorWithText().isBoundary(offset); positionCursor = true; - } else if (offset - mTouchWordOffset > mPreviousOffset) { + } else if (offset - mTouchWordOffset > mPreviousOffset || currLine > mPrevLine) { // User is shrinking the selection. if (currLine > mPrevLine) { // We're on a different line, so we'll snap to word boundaries. - offset = end; + offset = start; + mTouchWordOffset = Math.max(trueOffset - offset, 0); + } else { + offset -= mTouchWordOffset; } - offset -= mTouchWordOffset; - mInWord = !getWordIteratorWithText().isBoundary(offset); positionCursor = true; } @@ -3999,7 +3999,9 @@ public class Editor { } else { offset = alteredOffset; } + mTouchWordOffset = 0; } + mInWord = !getWordIteratorWithText().isBoundary(offset); positionAtCursorOffset(offset, false); } } @@ -4072,17 +4074,17 @@ public class Editor { } } mTouchWordOffset = Math.max(offset - trueOffset, 0); - mInWord = !getWordIteratorWithText().isBoundary(offset); positionCursor = true; - } else if (offset + mTouchWordOffset < mPreviousOffset) { + } else if (offset + mTouchWordOffset < mPreviousOffset || currLine < mPrevLine) { // User is shrinking the selection. if (currLine < mPrevLine) { // We're on a different line, so we'll snap to word boundaries. - offset = start; + offset = end; + mTouchWordOffset = Math.max(offset - trueOffset, 0); + } else { + offset += mTouchWordOffset; } - offset += mTouchWordOffset; positionCursor = true; - mInWord = !getWordIteratorWithText().isBoundary(offset); } if (positionCursor) { @@ -4097,7 +4099,9 @@ public class Editor { } else { offset = Math.min(alteredOffset, length); } + mTouchWordOffset = 0; } + mInWord = !getWordIteratorWithText().isBoundary(offset); positionAtCursorOffset(offset, false); } } diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index f94f97c..ff587c2 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -26,13 +26,11 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Insets; -import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; -import android.os.Bundle; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; @@ -46,7 +44,7 @@ import android.view.Gravity; import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.VelocityTracker; -import android.view.ViewAssistStructure; +import android.view.ViewStructure; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; @@ -1363,8 +1361,8 @@ public class Switch extends CompoundButton { } @Override - public void onProvideAssistStructure(ViewAssistStructure structure) { - super.onProvideAssistStructure(structure); + public void onProvideStructure(ViewStructure structure) { + super.onProvideStructure(structure); CharSequence switchText = isChecked() ? mTextOn : mTextOff; if (!TextUtils.isEmpty(switchText)) { CharSequence oldText = structure.getText(); diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index b9a08f5..68c49cd 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -114,7 +114,7 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; -import android.view.ViewAssistStructure; +import android.view.ViewStructure; import android.view.ViewConfiguration; import android.view.ViewDebug; import android.view.ViewGroup.LayoutParams; @@ -8715,8 +8715,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } @Override - public void onProvideAssistStructure(ViewAssistStructure structure) { - super.onProvideAssistStructure(structure); + public void onProvideStructure(ViewStructure structure) { + super.onProvideStructure(structure); final boolean isPassword = hasPasswordTransformationMethod(); if (!isPassword) { structure.setText(getText(), getSelectionStart(), getSelectionEnd()); diff --git a/core/java/com/android/internal/app/RestrictionsPinActivity.java b/core/java/com/android/internal/app/RestrictionsPinActivity.java deleted file mode 100644 index 66585c6..0000000 --- a/core/java/com/android/internal/app/RestrictionsPinActivity.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.app; - -import android.content.Context; -import android.os.Bundle; -import android.os.UserManager; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.KeyEvent; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.EditText; -import android.widget.TextView; -import android.widget.TextView.OnEditorActionListener; - -import com.android.internal.R; - -/** - * This activity is launched by Settings and other apps to either create a new PIN or - * challenge for an existing PIN. The PIN is maintained by UserManager. - */ -public class RestrictionsPinActivity extends AlertActivity - implements OnClickListener, TextWatcher, OnEditorActionListener { - - protected UserManager mUserManager; - protected boolean mHasRestrictionsPin; - - protected EditText mPinText; - protected TextView mPinErrorMessage; - private Button mOkButton; - private Button mCancelButton; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - - mUserManager = (UserManager) getSystemService(Context.USER_SERVICE); - mHasRestrictionsPin = mUserManager.hasRestrictionsChallenge(); - initUi(); - setupAlert(); - } - - protected void initUi() { - AlertController.AlertParams ap = mAlertParams; - ap.mTitle = getString(R.string.restr_pin_enter_admin_pin); - LayoutInflater inflater = - (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); - ap.mView = inflater.inflate(R.layout.restrictions_pin_challenge, null); - - mPinErrorMessage = (TextView) ap.mView.findViewById(R.id.pin_error_message); - mPinText = (EditText) ap.mView.findViewById(R.id.pin_text); - mOkButton = (Button) ap.mView.findViewById(R.id.pin_ok_button); - mCancelButton = (Button) ap.mView.findViewById(R.id.pin_cancel_button); - - mPinText.addTextChangedListener(this); - - mOkButton.setOnClickListener(this); - mCancelButton.setOnClickListener(this); - } - - protected boolean verifyingPin() { - return true; - } - - public void onResume() { - super.onResume(); - - setPositiveButtonState(false); - boolean hasPin = mUserManager.hasRestrictionsChallenge(); - if (hasPin) { - mPinErrorMessage.setVisibility(View.INVISIBLE); - mPinText.setOnEditorActionListener(this); - updatePinTimer(-1); - } else if (verifyingPin()) { - setResult(RESULT_OK); - finish(); - } - } - - protected void setPositiveButtonState(boolean enabled) { - mOkButton.setEnabled(enabled); - } - - private boolean updatePinTimer(int pinTimerMs) { - if (pinTimerMs < 0) { - pinTimerMs = mUserManager.checkRestrictionsChallenge(null); - } - boolean enableInput; - if (pinTimerMs >= 200) { - // Do the count down timer for less than a minute, otherwise just say try again later. - if (pinTimerMs <= 60000) { - final int seconds = (pinTimerMs + 200) / 1000; - final String formatString = getResources().getQuantityString( - R.plurals.restr_pin_countdown, - seconds); - mPinErrorMessage.setText(String.format(formatString, seconds)); - } else { - mPinErrorMessage.setText(R.string.restr_pin_try_later); - } - enableInput = false; - mPinErrorMessage.setVisibility(View.VISIBLE); - mPinText.setText(""); - mPinText.postDelayed(mCountdownRunnable, Math.min(1000, pinTimerMs)); - } else { - enableInput = true; - mPinErrorMessage.setText(R.string.restr_pin_incorrect); - } - mPinText.setEnabled(enableInput); - setPositiveButtonState(enableInput); - return enableInput; - } - - protected void performPositiveButtonAction() { - int result = mUserManager.checkRestrictionsChallenge(mPinText.getText().toString()); - if (result == UserManager.PIN_VERIFICATION_SUCCESS) { - setResult(RESULT_OK); - finish(); - } else if (result >= 0) { - mPinErrorMessage.setText(R.string.restr_pin_incorrect); - mPinErrorMessage.setVisibility(View.VISIBLE); - updatePinTimer(result); - mPinText.setText(""); - } - } - - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - CharSequence pin = mPinText.getText(); - setPositiveButtonState(pin != null && pin.length() >= 4); - } - - @Override - public void afterTextChanged(Editable s) { - } - - @Override - public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { - performPositiveButtonAction(); - return true; - } - - private Runnable mCountdownRunnable = new Runnable() { - public void run() { - if (updatePinTimer(-1)) { - // If we are no longer counting down, clear the message. - mPinErrorMessage.setVisibility(View.INVISIBLE); - } - } - }; - - @Override - public void onClick(View v) { - if (v == mOkButton) { - performPositiveButtonAction(); - } else if (v == mCancelButton) { - setResult(RESULT_CANCELED); - finish(); - } - } -} diff --git a/core/java/com/android/server/BootReceiver.java b/core/java/com/android/server/BootReceiver.java index 155f5d3..92d5aea 100644 --- a/core/java/com/android/server/BootReceiver.java +++ b/core/java/com/android/server/BootReceiver.java @@ -144,10 +144,6 @@ public class BootReceiver extends BroadcastReceiver { -LOG_SIZE, "SYSTEM_RECOVERY_LOG"); addFileToDropBox(db, prefs, headers, "/cache/recovery/last_kmsg", -LOG_SIZE, "SYSTEM_RECOVERY_KMSG"); - addFileToDropBox(db, prefs, headers, "/data/dontpanic/apanic_console", - -LOG_SIZE, "APANIC_CONSOLE"); - addFileToDropBox(db, prefs, headers, "/data/dontpanic/apanic_threads", - -LOG_SIZE, "APANIC_THREADS"); addAuditErrorsToDropBox(db, prefs, headers, -LOG_SIZE, "SYSTEM_AUDIT"); addFsckErrorsToDropBox(db, prefs, headers, -LOG_SIZE, "SYSTEM_FSCK"); } else { diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp index 662ecd3..aeb058b 100644 --- a/core/jni/android_media_AudioTrack.cpp +++ b/core/jni/android_media_AudioTrack.cpp @@ -35,7 +35,7 @@ #include "android_media_AudioFormat.h" #include "android_media_AudioErrors.h" -#include "android_media_PlaybackSettings.h" +#include "android_media_PlaybackParams.h" #include "android_media_DeviceCallback.h" // ---------------------------------------------------------------------------- @@ -61,7 +61,7 @@ struct audio_attributes_fields_t { }; static audio_track_fields_t javaAudioTrackFields; static audio_attributes_fields_t javaAudioAttrFields; -static PlaybackSettings::fields_t gPlaybackSettingsFields; +static PlaybackParams::fields_t gPlaybackParamsFields; struct audiotrack_callback_cookie { jclass audioTrack_class; @@ -693,8 +693,8 @@ static jint android_media_AudioTrack_get_playback_rate(JNIEnv *env, jobject thi // ---------------------------------------------------------------------------- -static void android_media_AudioTrack_set_playback_settings(JNIEnv *env, jobject thiz, - jobject settings) { +static void android_media_AudioTrack_set_playback_params(JNIEnv *env, jobject thiz, + jobject params) { sp<AudioTrack> lpTrack = getAudioTrack(env, thiz); if (lpTrack == NULL) { jniThrowException(env, "java/lang/IllegalStateException", @@ -702,10 +702,10 @@ static void android_media_AudioTrack_set_playback_settings(JNIEnv *env, jobject return; } - PlaybackSettings pbs; - pbs.fillFromJobject(env, gPlaybackSettingsFields, settings); + PlaybackParams pbs; + pbs.fillFromJobject(env, gPlaybackParamsFields, params); - ALOGV("setPlaybackSettings: %d:%f %d:%f %d:%u %d:%u", + ALOGV("setPlaybackParams: %d:%f %d:%f %d:%u %d:%u", pbs.speedSet, pbs.audioRate.mSpeed, pbs.pitchSet, pbs.audioRate.mPitch, pbs.audioFallbackModeSet, pbs.audioRate.mFallbackMode, @@ -719,8 +719,8 @@ static void android_media_AudioTrack_set_playback_settings(JNIEnv *env, jobject // ---------------------------------------------------------------------------- -static jobject android_media_AudioTrack_get_playback_settings(JNIEnv *env, jobject thiz, - jobject settings) { +static jobject android_media_AudioTrack_get_playback_params(JNIEnv *env, jobject thiz, + jobject params) { sp<AudioTrack> lpTrack = getAudioTrack(env, thiz); if (lpTrack == NULL) { jniThrowException(env, "java/lang/IllegalStateException", @@ -728,13 +728,13 @@ static jobject android_media_AudioTrack_get_playback_settings(JNIEnv *env, jobj return NULL; } - PlaybackSettings pbs; + PlaybackParams pbs; pbs.audioRate = lpTrack->getPlaybackRate(); pbs.speedSet = true; pbs.pitchSet = true; pbs.audioFallbackModeSet = true; pbs.audioStretchModeSet = true; - return pbs.asJobject(env, gPlaybackSettingsFields); + return pbs.asJobject(env, gPlaybackParamsFields); } @@ -1049,12 +1049,12 @@ static JNINativeMethod gMethods[] = { "(I)I", (void *)android_media_AudioTrack_set_playback_rate}, {"native_get_playback_rate", "()I", (void *)android_media_AudioTrack_get_playback_rate}, - {"native_set_playback_settings", - "(Landroid/media/PlaybackSettings;)V", - (void *)android_media_AudioTrack_set_playback_settings}, - {"native_get_playback_settings", - "()Landroid/media/PlaybackSettings;", - (void *)android_media_AudioTrack_get_playback_settings}, + {"native_set_playback_params", + "(Landroid/media/PlaybackParams;)V", + (void *)android_media_AudioTrack_set_playback_params}, + {"native_get_playback_params", + "()Landroid/media/PlaybackParams;", + (void *)android_media_AudioTrack_get_playback_params}, {"native_set_marker_pos","(I)I", (void *)android_media_AudioTrack_set_marker_pos}, {"native_get_marker_pos","()I", (void *)android_media_AudioTrack_get_marker_pos}, {"native_set_pos_update_period", @@ -1144,8 +1144,8 @@ int register_android_media_AudioTrack(JNIEnv *env) env->DeleteLocalRef(audioAttrClass); - // initialize PlaybackSettings field info - gPlaybackSettingsFields.init(env); + // initialize PlaybackParams field info + gPlaybackParamsFields.init(env); return RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods)); } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 5669b91..7b53578 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2573,17 +2573,6 @@ android:process=":ui"> </activity> - <activity android:name="com.android.internal.app.RestrictionsPinActivity" - android:theme="@style/Theme.Material.DayNight.Dialog.Alert" - android:excludeFromRecents="true" - android:windowSoftInputMode="adjustPan" - android:process=":ui"> - <intent-filter android:priority="100"> - <action android:name="android.intent.action.RESTRICTIONS_CHALLENGE" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - </activity> - <receiver android:name="com.android.server.BootReceiver" android:primaryUserOnly="true"> <intent-filter android:priority="1000"> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index eaa6278..0b96d22 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2347,11 +2347,6 @@ be saved. --> <attr name="saveEnabled" format="boolean" /> - <!-- If true, no {@link android.view.ViewAssistStructure} data will be collected from - this view or any of its children. The default is false, allowing assist structure - to be reported by it. --> - <attr name="assistBlocked" format="boolean" /> - <!-- Specifies whether to filter touches when the view's window is obscured by another visible window. When set to true, the view will not receive touches whenever a toast, dialog or other window appears above the view's window. diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 297b302..e403a16 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2682,7 +2682,9 @@ <!-- NFC CardEmulation: dynamically load service resources --> <public type="attr" name="dynamicResources" /> - <public type="attr" name="assistBlocked" /> + <attr name="__reserved0" format="boolean" /> + <public type="attr" name="__reserved0" /> + <public type="attr" name="stylusButtonPressable" /> <public type="attr" name="supportsLaunchVoiceAssistFromKeyguard" /> <public type="attr" name="scrollIndicators" /> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 55b32e1..a3a6105 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -4068,10 +4068,13 @@ <string name="zen_mode_downtime_feature_name">Downtime</string> <!-- Zen mode - name of default automatic schedule for weeknights. [CHAR LIMIT=40] --> - <string name="zen_mode_default_weeknights_name">Weeknights</string> + <string name="zen_mode_default_weeknights_name">Weeknight</string> <!-- Zen mode - name of default automatic schedule for weekends. [CHAR LIMIT=40] --> - <string name="zen_mode_default_weekends_name">Weekends</string> + <string name="zen_mode_default_weekends_name">Weekend</string> + + <!-- Zen mode - name of default automatic calendar event-based rule. [CHAR LIMIT=40] --> + <string name="zen_mode_default_events_name">Event</string> <!-- Indication that the current volume and other effects (vibration) are being suppressed by a third party, such as a notification listener. [CHAR LIMIT=30] --> <string name="muted_by">Muted by <xliff:g id="third_party">%1$s</xliff:g></string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 28ffbfa..801a98a 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2065,6 +2065,7 @@ <java-symbol type="string" name="zen_mode_downtime_feature_name" /> <java-symbol type="string" name="zen_mode_default_weeknights_name" /> <java-symbol type="string" name="zen_mode_default_weekends_name" /> + <java-symbol type="string" name="zen_mode_default_events_name" /> <java-symbol type="array" name="config_system_condition_providers" /> <java-symbol type="string" name="muted_by" /> |