Log with timing of system events (e,g, Flight Mode on/off)


Question

I would like to find out at what time my phone (running Android 8.0.0) was last switched into/out of Flight (Airplane) Mode. Ideally, this would be part of a longer log with the timestamps of the last N FlightMode events, alongside other system-related events.



I didn't find any quick solutions by searching this site and others. Is there an easy way to find out this information?


Answer

You can use for this. Run this command:



adb shell dumpsys activity broadcasts 


The output would be overwhelming, but you need to look for the string android.intent.action.AIRPLANE_MODE there. You can use grep or save the output into a file and then do the search.



Look for that string under Historical Broadcast Background. You would find the timestamp you're looking for. It could look like this:





Historical Broadcast background #345:
BroadcastRecord{ 48eb128 u-1 android.intent.action.AIRPLANE_MODE } to user -1
Intent { act=android.intent.action.AIRPLANE_MODE flg=0x10 (has extras) }
extras: Bundle[{ state=true } ]
caller=android 1298:system/1000 pid=1298 uid=1000
enqueueClockTime=2019-01-10 00:00:01 dispatchClockTime=2019-01-10 00:00:01


You can also look under Historical Broadcasts summary (background).




#15: act=android.intent.action.AIRPLANE_MODE flg=0x10 (has extras)
0 dispatch +1ms finish
enq=2019-01-10 00:19:14 disp=2019-01-10 00:19:14 fin=2019-01-10 00:19:14
extras: Bundle[{ state=false } ]


state=true means Airplane mode was activated. state=false means it was deactivated.



All of this may seem like a trouble, so I suggest you use an automation app to listen to the intent for Airplane mode and take an action for you for convenience.



Both Tasker and MacroDroid should be able to help with this. In MacroDroid,



Trigger: Intent Received First:




  • Action: android.intent.action.AIRPLANE_MODE


    • Intent Extra:


      • Extra name: state

      • Extra value to match: true





Actions: do what you want with that



Constraints: none



Save this. Now clone this, configure the trigger and change the value for state to false. So you would have triggers for both states of Airplane mode.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes