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

Commit bd181bb8 authored by Jeff Brown's avatar Jeff Brown
Browse files

Propagate input ANR reason to activity manager log.

Make it a little easier to diagnose input dispatch timeouts by
providing the detailed reason as the ANR annotation in the log.

Bug: 10689184
Change-Id: Ie18fd9ad066b0673d1f57c030e027ad0085f4650
parent 23a5f44c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1917,7 +1917,8 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            data.enforceInterface(IActivityManager.descriptor);
            int pid = data.readInt();
            boolean aboveSystem = data.readInt() != 0;
            long res = inputDispatchingTimedOut(pid, aboveSystem);
            String reason = data.readString();
            long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
            reply.writeNoException();
            reply.writeLong(res);
            return true;
@@ -4462,12 +4463,14 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
    public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(pid);
        data.writeInt(aboveSystem ? 1 : 0);
        data.writeString(reason);
        mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
        reply.readException();
        long res = reply.readInt();
+2 −1
Original line number Diff line number Diff line
@@ -384,7 +384,8 @@ public interface IActivityManager extends IInterface {

    public void requestBugReport() throws RemoteException;

    public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException;
    public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
            throws RemoteException;

    public Bundle getAssistContextExtras(int requestType) throws RemoteException;

+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ interface IApplicationToken
    void windowsDrawn();
    void windowsVisible();
    void windowsGone();
    boolean keyDispatchingTimedOut();
    boolean keyDispatchingTimedOut(String reason);
    long getKeyDispatchingTimeout();
}
+3 −1
Original line number Diff line number Diff line
@@ -3405,6 +3405,7 @@ void InputDispatcher::onANRLocked(
            & InputDispatcher::doNotifyANRLockedInterruptible);
    commandEntry->inputApplicationHandle = applicationHandle;
    commandEntry->inputWindowHandle = windowHandle;
    commandEntry->reason = reason;
}

void InputDispatcher::doNotifyConfigurationChangedInterruptible(
@@ -3434,7 +3435,8 @@ void InputDispatcher::doNotifyANRLockedInterruptible(
    mLock.unlock();

    nsecs_t newTimeout = mPolicy->notifyANR(
            commandEntry->inputApplicationHandle, commandEntry->inputWindowHandle);
            commandEntry->inputApplicationHandle, commandEntry->inputWindowHandle,
            commandEntry->reason);

    mLock.lock();

+3 −1
Original line number Diff line number Diff line
@@ -202,7 +202,8 @@ public:
    /* Notifies the system that an application is not responding.
     * Returns a new timeout to continue waiting, or 0 to abort dispatch. */
    virtual nsecs_t notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle,
            const sp<InputWindowHandle>& inputWindowHandle) = 0;
            const sp<InputWindowHandle>& inputWindowHandle,
            const String8& reason) = 0;

    /* Notifies the system that an input channel is unrecoverably broken. */
    virtual void notifyInputChannelBroken(const sp<InputWindowHandle>& inputWindowHandle) = 0;
@@ -596,6 +597,7 @@ private:
        KeyEntry* keyEntry;
        sp<InputApplicationHandle> inputApplicationHandle;
        sp<InputWindowHandle> inputWindowHandle;
        String8 reason;
        int32_t userActivityEventType;
        uint32_t seq;
        bool handled;
Loading