Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d59a5d59 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Various fixes and improvements...

Issue #19912529: VI: VoiceInteractor callback ClassCastException

Fix to use correct argument.

Issue #19912636: VI: Documentation for VoiceInteractionSession.onBackPressed

Added documentation.

Issue #19912703: VI: VoiceInteractionSession NPE on Abort Request

Maybe fix this -- don't crash if there is no active session.

Issue #19953731: VI: Add value index to...
...android.app.VoiceInteractor.PickOptionRequest.Option

There is now an optional index integer that can be associated with
every Option object.

Issue #19912635: VI: Behavior of startActivity when in voice...
...interaction is unexpected

We now forcibly finish the current voice interaction task whenever
another activity takes focus from it.

Issue #20066569: Add API to request heap dumps

New ActivityManager API to set the pss limit to generate heap
dumps.

Also added app ops for assist receiving structure and screenshot
data, so that we can track when it does these things.

Change-Id: I688d4ff8f0bd0b8b9e3390a32375b4bb7875c1a1
parent cef55cde
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3553,6 +3553,7 @@ package android.app {
  public class ActivityManager {
    method public int addAppTask(android.app.Activity, android.content.Intent, android.app.ActivityManager.TaskDescription, android.graphics.Bitmap);
    method public boolean clearApplicationUserData();
    method public void clearWatchHeapLimit();
    method public void dumpPackageState(java.io.FileDescriptor, java.lang.String);
    method public android.util.Size getAppTaskThumbnailSize();
    method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks();
@@ -3579,6 +3580,8 @@ package android.app {
    method public void moveTaskToFront(int, int);
    method public void moveTaskToFront(int, int, android.os.Bundle);
    method public deprecated void restartPackage(java.lang.String);
    method public void setWatchHeapLimit(long);
    field public static final java.lang.String ACTION_REPORT_HEAP_LIMIT = "android.app.action.REPORT_HEAP_LIMIT";
    field public static final int LOCK_TASK_MODE_LOCKED = 1; // 0x1
    field public static final int LOCK_TASK_MODE_NONE = 0; // 0x0
    field public static final int LOCK_TASK_MODE_PINNED = 2; // 0x2
@@ -5434,10 +5437,12 @@ package android.app {
  public static final class VoiceInteractor.PickOptionRequest.Option implements android.os.Parcelable {
    ctor public VoiceInteractor.PickOptionRequest.Option(java.lang.CharSequence);
    ctor public VoiceInteractor.PickOptionRequest.Option(java.lang.CharSequence, int);
    method public android.app.VoiceInteractor.PickOptionRequest.Option addSynonym(java.lang.CharSequence);
    method public int countSynonyms();
    method public int describeContents();
    method public android.os.Bundle getExtras();
    method public int getIndex();
    method public java.lang.CharSequence getLabel();
    method public java.lang.CharSequence getSynonymAt(int);
    method public void setExtras(android.os.Bundle);
@@ -28208,6 +28213,7 @@ package android.service.voice {
    ctor public VoiceInteractionSession(android.content.Context);
    ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
    method public void finish();
    method public android.content.Context getContext();
    method public android.view.LayoutInflater getLayoutInflater();
    method public android.app.Dialog getWindow();
    method public void hide();
+6 −0
Original line number Diff line number Diff line
@@ -3641,6 +3641,7 @@ package android.app {
  public class ActivityManager {
    method public int addAppTask(android.app.Activity, android.content.Intent, android.app.ActivityManager.TaskDescription, android.graphics.Bitmap);
    method public boolean clearApplicationUserData();
    method public void clearWatchHeapLimit();
    method public void dumpPackageState(java.io.FileDescriptor, java.lang.String);
    method public android.util.Size getAppTaskThumbnailSize();
    method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks();
@@ -3668,6 +3669,8 @@ package android.app {
    method public void moveTaskToFront(int, int);
    method public void moveTaskToFront(int, int, android.os.Bundle);
    method public deprecated void restartPackage(java.lang.String);
    method public void setWatchHeapLimit(long);
    field public static final java.lang.String ACTION_REPORT_HEAP_LIMIT = "android.app.action.REPORT_HEAP_LIMIT";
    field public static final int LOCK_TASK_MODE_LOCKED = 1; // 0x1
    field public static final int LOCK_TASK_MODE_NONE = 0; // 0x0
    field public static final int LOCK_TASK_MODE_PINNED = 2; // 0x2
@@ -5525,10 +5528,12 @@ package android.app {
  public static final class VoiceInteractor.PickOptionRequest.Option implements android.os.Parcelable {
    ctor public VoiceInteractor.PickOptionRequest.Option(java.lang.CharSequence);
    ctor public VoiceInteractor.PickOptionRequest.Option(java.lang.CharSequence, int);
    method public android.app.VoiceInteractor.PickOptionRequest.Option addSynonym(java.lang.CharSequence);
    method public int countSynonyms();
    method public int describeContents();
    method public android.os.Bundle getExtras();
    method public int getIndex();
    method public java.lang.CharSequence getLabel();
    method public java.lang.CharSequence getSynonymAt(int);
    method public void setExtras(android.os.Bundle);
@@ -30283,6 +30288,7 @@ package android.service.voice {
    ctor public VoiceInteractionSession(android.content.Context);
    ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
    method public void finish();
    method public android.content.Context getContext();
    method public android.view.LayoutInflater getLayoutInflater();
    method public android.app.Dialog getWindow();
    method public void hide();
+2 −2
Original line number Diff line number Diff line
@@ -1189,12 +1189,12 @@ public class Am extends BaseCommand {
    private void runSetWatchHeap() throws Exception {
        String proc = nextArgRequired();
        String limit = nextArgRequired();
        mAm.setDumpHeapDebugLimit(proc, Long.parseLong(limit));
        mAm.setDumpHeapDebugLimit(proc, 0, Long.parseLong(limit), null);
    }

    private void runClearWatchHeap() throws Exception {
        String proc = nextArgRequired();
        mAm.setDumpHeapDebugLimit(proc, -1);
        mAm.setDumpHeapDebugLimit(proc, 0, -1, null);
    }

    private void runBugReport() throws Exception {
+41 −0
Original line number Diff line number Diff line
@@ -2681,6 +2681,47 @@ public class ActivityManager {
        }
    }

    /**
     * Request that the system start watching for the calling process to exceed a pss
     * size as given here.  Once called, the system will look for any occassions where it
     * sees the associated process with a larger pss size and, when this happens, automatically
     * pull a heap dump from it and allow the user to share the data.  Note that this request
     * continues running even if the process is killed and restarted.  To remove the watch,
     * use {@link #clearWatchHeapLimit()}.
     *
     * <p>This API only work if running on a debuggable (userdebug or eng) build.</p>
     *
     * <p>Callers can optionally implement {@link #ACTION_REPORT_HEAP_LIMIT} to directly
     * handle heap limit reports themselves.</p>
     *
     * @param pssSize The size in bytes to set the limit at.
     */
    public void setWatchHeapLimit(long pssSize) {
        try {
            ActivityManagerNative.getDefault().setDumpHeapDebugLimit(null, 0, pssSize,
                    mContext.getPackageName());
        } catch (RemoteException e) {
        }
    }

    /**
     * Action an app can implement to handle reports from {@link #setWatchHeapLimit(long)}.
     * If your package has an activity handling this action, it will be launched with the
     * heap data provided to it the same way as {@link Intent#ACTION_SEND}.  Note that to
     * match the activty must support this action and a MIME type of "*&#47;*".
     */
    public static final String ACTION_REPORT_HEAP_LIMIT = "android.app.action.REPORT_HEAP_LIMIT";

    /**
     * Clear a heap watch limit previously set by {@link #setWatchHeapLimit(long)}.
     */
    public void clearWatchHeapLimit() {
        try {
            ActivityManagerNative.getDefault().setDumpHeapDebugLimit(null, 0, 0, null);
        } catch (RemoteException e) {
        }
    }

    /**
     * @hide
     */
+7 −2
Original line number Diff line number Diff line
@@ -2427,8 +2427,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            String procName = data.readString();
            int uid = data.readInt();
            long maxMemSize = data.readLong();
            setDumpHeapDebugLimit(procName, maxMemSize);
            String reportPackage = data.readString();
            setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage);
            reply.writeNoException();
            return true;
        }
@@ -5644,12 +5646,15 @@ class ActivityManagerProxy implements IActivityManager
    }

    @Override
    public void setDumpHeapDebugLimit(String processName, long maxMemSize) throws RemoteException {
    public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize,
            String reportPackage) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeString(processName);
        data.writeInt(uid);
        data.writeLong(maxMemSize);
        data.writeString(reportPackage);
        mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0);
        reply.readException();
        data.recycle();
Loading