Rename ANR -> Anr
To follow the code style, rename ANR -> Anr, because we are about to add
a lot more ANR-related stuff, and we don't want to keep adding new code
that doesn't follow the code style.
Bug: 143459140
Test: build only
Change-Id: I5a97ba4dcd8baa8a34fbb790e68fb63fd3c3ca75
diff --git a/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp b/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
index 7c5c9c5..395da87 100644
--- a/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
+++ b/services/inputflinger/benchmarks/InputDispatcher_benchmarks.cpp
@@ -47,7 +47,7 @@
private:
virtual void notifyConfigurationChanged(nsecs_t) override {}
- virtual nsecs_t notifyANR(const sp<InputApplicationHandle>&, const sp<IBinder>&,
+ virtual nsecs_t notifyAnr(const sp<InputApplicationHandle>&, const sp<IBinder>&,
const std::string& name) override {
ALOGE("The window is not responding : %s", name.c_str());
return 0;
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index baf2f2b..d49f149 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -531,7 +531,7 @@
}
// Get ready to dispatch the event.
- resetANRTimeoutsLocked();
+ resetAnrTimeoutsLocked();
}
// Now we have an event to dispatch.
@@ -888,7 +888,7 @@
void InputDispatcher::releasePendingEventLocked() {
if (mPendingEvent) {
- resetANRTimeoutsLocked();
+ resetAnrTimeoutsLocked();
releaseInboundEventLocked(mPendingEvent);
mPendingEvent = nullptr;
}
@@ -1299,7 +1299,7 @@
}
if (currentTime >= mInputTargetWaitTimeoutTime) {
- onANRLocked(currentTime, applicationHandle, windowHandle, entry.eventTime,
+ onAnrLocked(currentTime, applicationHandle, windowHandle, entry.eventTime,
mInputTargetWaitStartTime, reason);
// Force poll loop to wake up immediately on next iteration once we get the
@@ -1352,7 +1352,7 @@
return 0;
}
-void InputDispatcher::resetANRTimeoutsLocked() {
+void InputDispatcher::resetAnrTimeoutsLocked() {
if (DEBUG_FOCUS) {
ALOGD("Resetting ANR timeouts.");
}
@@ -3800,12 +3800,12 @@
if (inputApplicationHandle != nullptr && inputApplicationHandle->updateInfo()) {
if (oldFocusedApplicationHandle != inputApplicationHandle) {
if (oldFocusedApplicationHandle != nullptr) {
- resetANRTimeoutsLocked();
+ resetAnrTimeoutsLocked();
}
mFocusedApplicationHandlesByDisplay[displayId] = inputApplicationHandle;
}
} else if (oldFocusedApplicationHandle != nullptr) {
- resetANRTimeoutsLocked();
+ resetAnrTimeoutsLocked();
oldFocusedApplicationHandle.clear();
mFocusedApplicationHandlesByDisplay.erase(displayId);
}
@@ -3886,7 +3886,7 @@
if (mDispatchEnabled != enabled || mDispatchFrozen != frozen) {
if (mDispatchFrozen && !frozen) {
- resetANRTimeoutsLocked();
+ resetAnrTimeoutsLocked();
}
if (mDispatchEnabled && !enabled) {
@@ -4026,7 +4026,7 @@
resetKeyRepeatLocked();
releasePendingEventLocked();
drainInboundQueueLocked();
- resetANRTimeoutsLocked();
+ resetAnrTimeoutsLocked();
mTouchStatesByDisplay.clear();
mLastHoverWindowHandle.clear();
@@ -4526,7 +4526,7 @@
postCommandLocked(std::move(commandEntry));
}
-void InputDispatcher::onANRLocked(nsecs_t currentTime,
+void InputDispatcher::onAnrLocked(nsecs_t currentTime,
const sp<InputApplicationHandle>& applicationHandle,
const sp<InputWindowHandle>& windowHandle, nsecs_t eventTime,
nsecs_t waitStartTime, const char* reason) {
@@ -4543,19 +4543,19 @@
localtime_r(&t, &tm);
char timestr[64];
strftime(timestr, sizeof(timestr), "%F %T", &tm);
- mLastANRState.clear();
- mLastANRState += INDENT "ANR:\n";
- mLastANRState += StringPrintf(INDENT2 "Time: %s\n", timestr);
- mLastANRState +=
+ mLastAnrState.clear();
+ mLastAnrState += INDENT "ANR:\n";
+ mLastAnrState += StringPrintf(INDENT2 "Time: %s\n", timestr);
+ mLastAnrState +=
StringPrintf(INDENT2 "Window: %s\n",
getApplicationWindowLabel(applicationHandle, windowHandle).c_str());
- mLastANRState += StringPrintf(INDENT2 "DispatchLatency: %0.1fms\n", dispatchLatency);
- mLastANRState += StringPrintf(INDENT2 "WaitDuration: %0.1fms\n", waitDuration);
- mLastANRState += StringPrintf(INDENT2 "Reason: %s\n", reason);
- dumpDispatchStateLocked(mLastANRState);
+ mLastAnrState += StringPrintf(INDENT2 "DispatchLatency: %0.1fms\n", dispatchLatency);
+ mLastAnrState += StringPrintf(INDENT2 "WaitDuration: %0.1fms\n", waitDuration);
+ mLastAnrState += StringPrintf(INDENT2 "Reason: %s\n", reason);
+ dumpDispatchStateLocked(mLastAnrState);
std::unique_ptr<CommandEntry> commandEntry =
- std::make_unique<CommandEntry>(&InputDispatcher::doNotifyANRLockedInterruptible);
+ std::make_unique<CommandEntry>(&InputDispatcher::doNotifyAnrLockedInterruptible);
commandEntry->inputApplicationHandle = applicationHandle;
commandEntry->inputChannel =
windowHandle != nullptr ? getInputChannelLocked(windowHandle->getToken()) : nullptr;
@@ -4591,13 +4591,13 @@
mLock.lock();
}
-void InputDispatcher::doNotifyANRLockedInterruptible(CommandEntry* commandEntry) {
+void InputDispatcher::doNotifyAnrLockedInterruptible(CommandEntry* commandEntry) {
sp<IBinder> token =
commandEntry->inputChannel ? commandEntry->inputChannel->getConnectionToken() : nullptr;
mLock.unlock();
nsecs_t newTimeout =
- mPolicy->notifyANR(commandEntry->inputApplicationHandle, token, commandEntry->reason);
+ mPolicy->notifyAnr(commandEntry->inputApplicationHandle, token, commandEntry->reason);
mLock.lock();
@@ -4958,9 +4958,9 @@
dump += "Input Dispatcher State:\n";
dumpDispatchStateLocked(dump);
- if (!mLastANRState.empty()) {
+ if (!mLastAnrState.empty()) {
dump += "\nInput Dispatcher State at time of last ANR:\n";
- dump += mLastANRState;
+ dump += mLastAnrState;
}
}
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 2b9cbce..a2c727f 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -314,7 +314,7 @@
int32_t mFocusedDisplayId GUARDED_BY(mLock);
// Dispatcher state at time of last ANR.
- std::string mLastANRState GUARDED_BY(mLock);
+ std::string mLastAnrState GUARDED_BY(mLock);
// Dispatch inbound events.
bool dispatchConfigurationChangedLocked(nsecs_t currentTime, ConfigurationChangedEntry* entry)
@@ -360,7 +360,7 @@
const sp<IBinder>& inputConnectionToken)
REQUIRES(mLock);
nsecs_t getTimeSpentWaitingForApplicationLocked(nsecs_t currentTime) REQUIRES(mLock);
- void resetANRTimeoutsLocked() REQUIRES(mLock);
+ void resetAnrTimeoutsLocked() REQUIRES(mLock);
int32_t getTargetDisplayId(const EventEntry& entry);
int32_t findFocusedWindowTargetsLocked(nsecs_t currentTime, const EventEntry& entry,
@@ -468,7 +468,7 @@
REQUIRES(mLock);
void onFocusChangedLocked(const sp<InputWindowHandle>& oldFocus,
const sp<InputWindowHandle>& newFocus) REQUIRES(mLock);
- void onANRLocked(nsecs_t currentTime, const sp<InputApplicationHandle>& applicationHandle,
+ void onAnrLocked(nsecs_t currentTime, const sp<InputApplicationHandle>& applicationHandle,
const sp<InputWindowHandle>& windowHandle, nsecs_t eventTime,
nsecs_t waitStartTime, const char* reason) REQUIRES(mLock);
@@ -477,7 +477,7 @@
REQUIRES(mLock);
void doNotifyInputChannelBrokenLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
void doNotifyFocusChangedLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
- void doNotifyANRLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
+ void doNotifyAnrLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
void doInterceptKeyBeforeDispatchingLockedInterruptible(CommandEntry* commandEntry)
REQUIRES(mLock);
void doDispatchCycleFinishedLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherPolicyInterface.h b/services/inputflinger/dispatcher/include/InputDispatcherPolicyInterface.h
index 4214488..667af9b 100644
--- a/services/inputflinger/dispatcher/include/InputDispatcherPolicyInterface.h
+++ b/services/inputflinger/dispatcher/include/InputDispatcherPolicyInterface.h
@@ -47,7 +47,7 @@
/* 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,
+ virtual nsecs_t notifyAnr(const sp<InputApplicationHandle>& inputApplicationHandle,
const sp<IBinder>& token, const std::string& reason) = 0;
/* Notifies the system that an input channel is unrecoverably broken. */
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index 365d43d..2b74868 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -127,19 +127,16 @@
mConfigurationChangedTime = when;
}
- virtual nsecs_t notifyANR(const sp<InputApplicationHandle>&,
- const sp<IBinder>&,
- const std::string&) {
+ virtual nsecs_t notifyAnr(const sp<InputApplicationHandle>&, const sp<IBinder>&,
+ const std::string&) override {
return 0;
}
- virtual void notifyInputChannelBroken(const sp<IBinder>&) {
- }
+ virtual void notifyInputChannelBroken(const sp<IBinder>&) override {}
- virtual void notifyFocusChanged(const sp<IBinder>&, const sp<IBinder>&) {
- }
+ virtual void notifyFocusChanged(const sp<IBinder>&, const sp<IBinder>&) override {}
- virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) {
+ virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) override {
*outConfig = mConfig;
}
@@ -160,19 +157,17 @@
return true;
}
- virtual void interceptKeyBeforeQueueing(const KeyEvent*, uint32_t&) {
- }
+ virtual void interceptKeyBeforeQueueing(const KeyEvent*, uint32_t&) override {}
- virtual void interceptMotionBeforeQueueing(int32_t, nsecs_t, uint32_t&) {
- }
+ virtual void interceptMotionBeforeQueueing(int32_t, nsecs_t, uint32_t&) override {}
- virtual nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>&,
- const KeyEvent*, uint32_t) {
+ virtual nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>&, const KeyEvent*,
+ uint32_t) override {
return 0;
}
- virtual bool dispatchUnhandledKey(const sp<IBinder>&,
- const KeyEvent*, uint32_t, KeyEvent*) {
+ virtual bool dispatchUnhandledKey(const sp<IBinder>&, const KeyEvent*, uint32_t,
+ KeyEvent*) override {
return false;
}
@@ -184,14 +179,13 @@
mLastNotifySwitch = NotifySwitchArgs(1 /*id*/, when, policyFlags, switchValues, switchMask);
}
- virtual void pokeUserActivity(nsecs_t, int32_t) {
- }
+ virtual void pokeUserActivity(nsecs_t, int32_t) override {}
- virtual bool checkInjectEventsPermissionNonReentrant(int32_t, int32_t) {
+ virtual bool checkInjectEventsPermissionNonReentrant(int32_t, int32_t) override {
return false;
}
- virtual void onPointerDownOutsideFocus(const sp<IBinder>& newToken) {
+ virtual void onPointerDownOutsideFocus(const sp<IBinder>& newToken) override {
mOnPointerDownToken = newToken;
}