Stefan Huber
Aug 13, 2018
12:00 pm

ActivityManager kills our Pro Kiosk Mode app for chrome update?

Hello,

 

We're developing an application that should run as a status monitor on a Samsung Galaxy Tab S2 (Android 7).

To achieve this, we make use of the Pro Kiosk Mode. It is always connected via USB and constantly getting power supply.

 

Our Application uses the Chrome Web View.

From time to time we had the following incident:

 

- The tablet does no longer show our app screen (device admin and default app for the home key).

- Instead it shows whatever was shown before. The home screen, settings screen or app launcher.

- The user could open any app from this state, so the kiosk mode is no longer preventing that!

- Pressing the home button on the Tablet opens our application, so the kiosk mode is still doing that.

 

Searching the log we created via RUN DUMPSTATE/LOGCAT from the SysDump screen showed the following:
Our package is named com.company.our.package for this example.

 

08-10 14:27:18.312 1241 1271 I MSTG : com.android.chrome is installing..

08-10 14:27:18.574 1241 2361 D BatteryService: !@BatteryListener : batteryPropertiesChanged!

08-10 14:27:18.574 1241 2361 D BatteryService: level:100, scale:100, status:5, health:2, present:true, voltage: 4343, temperature: 351, technology: Li-ion, AC powered:true, USB powered:false, POGO powered:false, Wireless powered:false, icon:17303700, invalid charger:0, maxChargingCurrent:0, maxChargingVoltage:0, chargeCounter:0

08-10 14:27:18.575 1241 2361 D BatteryService: online:14, current avg:-26, charge type:1, power sharing:false, high voltage charger:false, capacity:280000, batterySWSelfDischarging:false, misc_event:0, current_now:7

08-10 14:27:18.575 1241 1241 D BatteryService: Sending ACTION_BATTERY_CHANGED.

08-10 14:27:18.576 1241 1241 D GameManagerService: new battery level: 100

08-10 14:27:20.067 1241 3191 D GameManagerService: identifyGamePackage. com.company.our.package

08-10 14:27:20.068 1241 3191 D ax : limitCPUFreq:: freq = -1

08-10 14:27:20.068 1241 3191 D CustomFrequencyManagerService: releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MAX_LIMIT frequency : 1612800 uid : 1000 pid : 1241 tag : SIOP_ARM_MAX@34

08-10 14:27:20.069 1241 3191 D ax : limitGPUFreq:: freq = -1

08-10 14:27:25.615 1241 3191 D SSRM:s : SIOP:: AP = 520, PST = 493 (W:30), CP = 62, LCD = 128

08-10 14:27:28.623 1241 2384 D BatteryService: !@BatteryListener : batteryPropertiesChanged!

08-10 14:27:28.623 1241 2384 D BatteryService: level:100, scale:100, status:5, health:2, present:true, voltage: 4343, temperature: 348, technology: Li-ion, AC powered:true, USB powered:false, POGO powered:false, Wireless powered:false, icon:17303700, invalid charger:0, maxChargingCurrent:0, maxChargingVoltage:0, chargeCounter:0

08-10 14:27:28.623 1241 2384 D BatteryService: online:14, current avg:36, charge type:1, power sharing:false, high voltage charger:false, capacity:280000, batterySWSelfDischarging:false, misc_event:0, current_now:85

08-10 14:27:28.623 1241 1241 D BatteryService: Sending ACTION_BATTERY_CHANGED.

08-10 14:27:28.628 1241 1241 D GameManagerService: new battery level: 100

08-10 14:27:35.654 1241 3191 D SSRM:s : SIOP:: AP = 520, PST = 494 (W:30), CP = 62, LCD = 128

08-10 14:27:38.674 1241 1251 D BatteryService: !@BatteryListener : batteryPropertiesChanged!

08-10 14:27:38.924 1241 1835 E Watchdog: !@Sync 2623 [2018-08-10 15:27:38.924]

08-10 14:27:42.727 1241 1255 I ActivityManager: Force stopping com.android.chrome appid=10111 user=-1: installPackageLI

08-10 14:27:42.732 1241 1255 I ActivityManager: Killing 8213:com.company.our.package/u0a140 (adj 0): stop com.android.chrome cause installPackageLI



^^^^ This is where we get killed...



08-10 14:27:42.735 1241 1255 D ActivityManager: cleanUpApplicationRecord -- 8213

08-10 14:27:42.742 1241 1255 W ActivityManager: Force removing ActivityRecord{2afd7a3d0 u0 com.company.our.package/.MainActivity t30}: app *****, no saved state

08-10 14:27:42.744 1241 1255 D GameManagerService: sem_perfomance_mode: 3

08-10 14:27:42.754 1241 1271 W PackageManager: Trying to update system app code path from /data/app/com.android.chrome-1 to /data/app/com.android.chrome-2

08-10 14:27:42.755 1241 1271 D PackageManager: Resolved nativeLibraryRoot for com.android.chrome to root=/data/app/com.android.chrome-2/lib, isa=true

08-10 14:27:42.755 1241 1255 D WindowManager: disposeInputChannel mInputChannel: 6ef57db com.company.our.package/com.company.our.package.MainActivity (server)

08-10 14:27:42.756 1241 1271 W PackageManager: Code path for com.android.chrome changing from /data/app/com.android.chrome-1 to /data/app/com.android.chrome-2

08-10 14:27:42.756 1241 1271 W PackageManager: Resource path for com.android.chrome changing from /data/app/com.android.chrome-1 to /data/app/com.android.chrome-2

08-10 14:27:42.761 1241 1271 W PackageManager: Permission com.android.chrome.permission.DEBUG from package com.android.chrome in an unknown group android.permission-group.DEVELOPMENT_TOOLS

08-10 14:27:42.763 1241 1255 I WindowManager_SurfaceController: Destroying surface Surface(name=com.company.our.package/com.company.our.package.MainActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2958 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:1132 com.android.server.wm.WindowState.removeLocked:1879 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2949 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2909 com.android.server.wm.WindowManagerService.removeWindowLocked:2889 com.android.server.wm.WindowManagerService.removeWindowLocked:2699 com.android.server.wm.AppWindowToken.removeAllWindows:609

08-10 14:27:42.879 1241 1271 I PackageManager: Un-granting permission android.permission.sec.MDM_HW_CONTROL from package com.company.our.package (protectionLevel=2 flags=0x3888bf46)

08-10 14:27:42.879 1241 1271 I PackageManager: Un-granting permission android.permission.sec.MDM_APP_MGMT from package com.company.our.package (protectionLevel=2 flags=0x3888bf46)

08-10 14:27:42.879 1241 1271 I PackageManager: Un-granting permission android.permission.sec.MDM_KIOSK_MODE from package com.company.our.package (protectionLevel=2 flags=0x3888bf46)

08-10 14:27:42.879 1241 1271 I PackageManager: Un-granting permission com.sec.enterprise.knox.permission.CUSTOM_SYSTEM from package com.company.our.package (protectionLevel=18 flags=0x3888bf46)

08-10 14:27:42.884 1241 1271 D PackageManager: [VERIFY] getRequiredButNotReallyRequiredVerifierLPr: 2 verifiers

08-10 14:27:42.884 1241 1271 D PackageManager: [VERIFY] com.android.vending(10024)

08-10 14:27:42.884 1241 1271 D PackageManager: [VERIFY] com.samsung.android.sm.devicesecurity(5012)

08-10 14:27:42.885 1241 1271 D PackageManager: [VERIFY] getRequiredButNotReallyRequiredVerifierLPr: 2 verifiers

08-10 14:27:42.885 1241 1271 D PackageManager: [VERIFY] com.android.vending(10024)

08-10 14:27:42.885 1241 1271 D PackageManager: [VERIFY] com.samsung.android.sm.devicesecurity(5012)

08-10 14:27:42.885 1241 1271 D PackageManager: [VERIFY] getRequiredButNotReallyRequiredVerifierLPr: 2 verifiers

08-10 14:27:42.885 1241 1271 D PackageManager: [VERIFY] com.android.vending(10024)

08-10 14:27:42.885 1241 1271 D PackageManager: [VERIFY] com.samsung.android.sm.devicesecurity(5012)

08-10 14:27:42.892 1241 2384 D PowerManagerService: [api] handleWakeLockDeath : release WakeLock : SCREEN_BRIGHT_WAKE_LOCK 'screenBrightWL' (uid=10140, pid=8213, ws=null) (uid=10140, pid=8213, ws=null, pkg=com.company.our.package, elapsedTime=77208553)

08-10 14:27:42.892 1241 2645 D PowerManagerService: [api] handleWakeLockDeath : release WakeLock : SCREEN_DIM_WAKE_LOCK 'screenDimWL' (uid=10140, pid=8213, ws=null) (uid=10140, pid=8213, ws=null, pkg=com.company.our.package, elapsedTime=77208552)

08-10 14:27:42.892 1241 2384 D PowerManagerService: mDisplayReady: false

 

... After this there is no more reference to our com.company.our.package until we noticed it and restarted the app.

 

Assumptions:

 

Our tablets are connected to the internet via wireless LAN.

Now I assume that Android is updating Chrome silently because of some security reason. As you can see from the line:

08-10 14:27:18.312 1241 1271 I MSTG : com.android.chrome is installing..

 

To finalize the update, Chrome must be closed as it seems:

08-10 14:27:42.727 1241 1255 I ActivityManager: Force stopping com.android.chrome appid=10111 user=-1: installPackageLI

 

Now since we make use of Chrome Web View, our app is also closed

08-10 14:27:42.732 1241 1255 I ActivityManager: Killing 8213:com.company.our.package/u0a140 (adj 0): stop com.android.chrome cause installPackageLI

 

Since we need our app to work as a status monitor, we need some way to prevent this,

or some workaround to make sure our App can be restored after it got closed by Android for security update purposes.

We thought abut some sort of separate process which attempts to restart our app.

This would be started from our main app's OnStop or OnDestroy life-cycle-hooks, but we'd rather avoid such a workaround.

What else could we do?

 

Sincerely

 

Stefan Huber

 

Similar topics

No similar topics found.
Jay Himanshu Jha
Sep 08, 2018
12:43 am

Hi Stefan,

Knox provides an API called addPackagesToDisableUpdateBlackList (https://seap.samsung.com/api-references/android-3-0/reference/com/samsun...(java.util.List%3Cjava.lang.String%3E) which allows you to prevent apps from updating. You can use this API to block Chrome from getting updated, which would prevent the webview component from restarting.

 

Regards,

Jay

Comments

Hello Jay,

Thank you for your reply!
This could be an option.

Let's assume we'd like to trigger an update manually, after temporarily removing the package from the blacklist and removing the WebView from our Activity.
Would this also be possible?
And if it is, is there any way to receive some event or similar, after the update is completed and it's save to reopen the WebView?

Currenlty we start a service, which stays around.
This service then tries to restart our Activity until is is possible again.
Does anything speak against this approach?

Regards,

Stefan

Stefan HuberSep 14, 2018 at 12:58 pm