I am reviving an old Android project. I am using Android Studio 2020.3.1 Patch 4 on MacOS Monterey. I have updated the project, addressed all errors and warnings in every class and view, I have removed/replaced all deprecated functions, and am successfully building and testing the application on a Galaxy S20 running Android 11. I am building to SDK 30. The application builds and runs but is VERY unresponsive. It will accept button clicks and keyboard entry eventually, but it feels very slow and random. In looking at the run log, I see the following message set repeated at a very high frequency:
D/Mo: onPause
I/ViewRootImpl@5d619c7[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@4ac2ae[MainActivity]
getNavigationBarColor() -16711423
D/InputMethodManager: prepareNavigationBarInfo() DecorView@4ac2ae[MainActivity]
getNavigationBarColor() -16711423
V/InputMethodManager: Starting input: tba=com.mullican.mo ic=null mNaviBarColor -16711423 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel constructed: 'ClientS', fd=87
D/InputMethodManager: prepareNavigationBarInfo() DecorView@4ac2ae[MainActivity]
getNavigationBarColor() -16711423
V/InputMethodManager: Starting input: tba=com.mullican.mo ic=null mNaviBarColor -16711423 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/SurfaceControl: nativeRelease nativeObject s[-5476376652132767936]
nativeRelease nativeObject e[-5476376652132767936]
nativeRelease nativeObject s[-5476376652132759840]
nativeRelease nativeObject e[-5476376652132759840]
I/ViewRootImpl@5d619c7[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
I/SurfaceControl: nativeRelease nativeObject s[-5476376652132850656]
nativeRelease nativeObject e[-5476376652132850656]
nativeRelease nativeObject s[-5476376652132847488]
nativeRelease nativeObject e[-5476376652132847488]
nativeRelease nativeObject s[-5476376652132891488]
nativeRelease nativeObject e[-5476376652132891488]
I/ViewRootImpl@5d619c7[MainActivity]: stopped(false) old=false
D/Mo: onResume
I/SurfaceControl: nativeRelease nativeObject s[-5476376652132899760]
nativeRelease nativeObject e[-5476376652132899760]
D/Mo: onPause
I/SurfaceControl: nativeRelease nativeObject s[-5476376652132767584]
nativeRelease nativeObject e[-5476376652132767584]
I/SurfaceControl: assignNativeObject: nativeObject = 0 Surface(name=null)/@0x77a85a8 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995
I/SurfaceControl: nativeRelease nativeObject s[-5476376652132900112]
nativeRelease nativeObject e[-5476376652132900112]
nativeRelease nativeObject s[-5476376652132849424]
nativeRelease nativeObject e[-5476376652132849424]
nativeRelease nativeObject s[-5476376652132849776]
nativeRelease nativeObject e[-5476376652132849776]
I/ViewRootImpl@5d619c7[MainActivity]: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)0 dur=8 res=0x1 s={true -5476376647837952720} ch=false fn=8
MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@4ac2ae[MainActivity]
getNavigationBarColor() -16711423
D/InputMethodManager: prepareNavigationBarInfo() DecorView@4ac2ae[MainActivity]
getNavigationBarColor() -16711423
V/InputMethodManager: Starting input: tba=com.mullican.mo ic=null mNaviBarColor -16711423 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel constructed: 'ClientS', fd=88
Input channel destroyed: 'ClientS', fd=87
I/ViewRootImpl@5d619c7[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
I/SurfaceControl: nativeRelease nativeObject s[-5476376652132767584]
nativeRelease nativeObject e[-5476376652132767584]
nativeRelease nativeObject s[-5476376652132850656]
nativeRelease nativeObject e[-5476376652132850656]
nativeRelease nativeObject s[-5476376652132897472]
nativeRelease nativeObject e[-5476376652132897472]
I/ViewRootImpl@5d619c7[MainActivity]: stopped(false) old=false
D/Mo: onResume
I/SurfaceControl: nativeRelease nativeObject s[-5476376652132848368]
nativeRelease nativeObject e[-5476376652132848368]
D/Mo: onPause
It appears that the app is continually pausing and resuming the MainActivity, jumping out to address whatever is indicated in the above log. I can see that my interactions with the app UI elements, when they happen, do happen between the onResume and onPause messages (those onResume and onPause messages are generated from the MainActivity calls of the same names). The vast majority of the time, the MainActivity is paused addressing whatever is indicated in the log above.
For some context, the app is essentially a chat app. It has a message history window that takes up most of the UI, a text entry box at the bottom, a submit button to enter the text into the message history and a slide-in drawer at the left to select from different message groups. The app also connects to a bluetooth LE device. I have tried disabling each of the UI elements and the bluetooth components individually, but the behavior remains the same.
Perhaps I am too close to the trees to see the forest. I would appreciate any guidance on a direction to debug this issue.