Tomasz Zakrzewski
Apr 16, 2018
9:53 am

Recent button in ProKioskMode

Hello

I have problem to enable recent button in ProKioskMode. I have set:

1) enable ProKioskMode:

pkm.setProKioskState(true, "12345");

2)
kioskModeService.allowTaskManager(true);

List<Integer> availableHwKeys = new ArrayList<>();
availableHwKeys.add(KeyEvent.KEYCODE_APP_SWITCH);
kioskModeService.allowHardwareKeys(availableHwKeys, true);

But button is not working.

b.r.

Kamil K.Samsung SEAP Moderator
Apr 17, 2018
8:34 am

Hello Tomasz,

It is not posible to enable recent apps button when Pro Kiosk is set. Basically Pro Kiosk is supposed to be used with single application.

Best regards

Comments

Thanks for response. It's any way to handle this button and create own one recent app?

Or will explain our company needs, maybe kiosk mode is not what we want.

We need to lock access to settings, all quick menu items except wifi, show only gallery, camera and our app on phone desktop. It's like kiosk mode but with access to wifi. My best fit was ProKiosk mode (used own custom launcher) but only missing recent app functionality. Maybe exist other way to do it? Without kiosk mode?

b.r.

Tomasz ZakrzewskiApr 17, 2018 at 10:09 am

if you want to use ProKiosk you may use below reflection method to open recent apps on devices with OS below Oreo.

Class serviceManagerClass = Class.forName("android.os.ServiceManager");
Method getService = serviceManagerClass.getMethod("getService", String.class);
IBinder retbinder = (IBinder) getService.invoke(serviceManagerClass, "statusbar");
Class statusBarClass = Class.forName(retbinder.getInterfaceDescriptor());
Object statusBarObject = statusBarClass.getClasses()[0].getMethod("asInterface", IBinder.class).invoke(null, new Object[]{retbinder});
Method toggleRecentApps = statusBarClass.getMethod("toggleRecentApps");
toggleRecentApps.setAccessible(true);
toggleRecentApps.invoke(statusBarObject);

Also it is possible to use Accessibility service (inject below call) for this purpose with no OS version limitation. However it is not possible to turn on Accessibility service automatically so the user need to do this manually before ProKiosk is enabled (access to settings is required)

performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS);

Alternatively you can use KioskMode which is not disabling recent apps button by default.

Kamil K.Apr 19, 2018 at 3:02 pm
Tomasz Zakrzewski
May 09, 2018
8:40 am

Hello

Both solutions are inappropriate.First is OS version limited, second needs android.permission.BIND_ACCESSIBILITY_SERVICE which now are banned by google when used to other things that assist users with disabilities (look on google for more info). Also if google will allow me to use it then in ProKioskMode I can't detect when recent app key is pushed/clicked because it completly disabled.

So even create own recent app UI is not possible and use it with recent app key.

KioskMode maybe good but there is another problem (can't hide system UI elements): https://seap.samsung.com/forum-topic/setsettingshiddenstate-not-working

Our needs is to allow only wifi changes but this need give restriction allowSettingsChanges = true and limit UI elements to WiFi only (user can't change some settings like APN, GPS, MobileData etc)

b.r.

Kamil K.Samsung SEAP Moderator
May 09, 2018
1:26 pm

If Wifi is the only settings element you need to provide for the users you may consider below approach.

block settings changesĀ  with allowSettingsChanges(false); and add activity to your application which allow users finding and connecting with wifi networks via

setWifiProfile()