Hakan Bingol
Dec 21, 2018
12:30 pm

java.lang.SecurityException: Operation not supported, Device permission not present

Hi

When I enable kiosk mode, I take an exception. 

My code:

EnterpriseKnoxManager enterpriseKnoxManager = EnterpriseKnoxManager.getInstance(this);
KnoxContainerManager knoxContainerManager = enterpriseKnoxManager.getKnoxContainerManager(mUtils.findMyContainerId());
KioskMode kioskMode = knoxContainerManager.getKioskMode();

boolean kioskState = kioskMode.isKioskModeEnabled();
if (kioskState) { // If in Kiosk Mode, disable Kiosk Mode
    mUtils.log(getString(R.string.leaving_kiosk));
    removeShortcutFromKioskMode();
    kioskMode.disableKioskMode();
} else { // If not in Kiosk Mode, enable Kiosk Mode with the current package as the home package
    mUtils.log(getString(R.string.entering_kiosk));
    kioskMode.enableKioskMode();
}

 

And also I added following permission in manifest file. 

<!-- Permissions TODO List permissions used by application -->
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_RESTRICTION_MGMT"/>
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_HW_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_LOCATION"/>
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_KIOSK_MODE"/>
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_CUSTOM_SEALEDMODE"/>
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_CONTAINER"/>
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_APP_MGMT"/>
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_PHONE_RESTRICTION"/>
<uses-permission android:name="android.permission.sec.MDM_ENTERPRISE_CONTAINER" />
<uses-permission android:name="android.permission.sec.MDM_APP_MGMT"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Could you help me?

 

Jay Himanshu Jha
Dec 28, 2018
7:42 pm

Hi Hakan,

Are you using the sample app provided on SEAP? 

When does this exception occur? Is it when you enable/disable kiosk mode?

Can you also provide the logs showing when the exception occurs?

Regards,

Jay

Hakan Bingol
Dec 31, 2018
6:12 am
Here is full crash log;
com.samsung.knox.example.knoxsdk E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.samsung.knox.example.knoxsdk, PID: 20842
    java.lang.SecurityException: Operation not supported, Device permission not present
        at android.os.Parcel.readException(Parcel.java:1959)
        at android.os.Parcel.readException(Parcel.java:1905)
        at com.samsung.android.knox.kiosk.IKioskMode$Stub$Proxy.enableKioskMode(IKioskMode.java:569)
        at com.samsung.android.knox.kiosk.KioskMode.enableKioskMode(KioskMode.java:317)
        at com.samsung.knox.example.knoxsdk.SampleActivity.kioskMode(SampleActivity.java:653)
        at com.samsung.knox.example.knoxsdk.SampleActivity.access$1000(SampleActivity.java:82)
        at com.samsung.knox.example.knoxsdk.SampleActivity$11.onClick(SampleActivity.java:182)
        at android.view.View.performClick(View.java:6897)
        at android.widget.TextView.performClick(TextView.java:12693)
        at android.view.View$PerformClick.run(View.java:26101)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6944)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Yes I am using sample app. First, I created the container which is "knox-b2b-lwc" type. (Also it doesn't madder which type I used) After I try enable kiosk mode. When I try to enable kiosk mode, I take security exception.

Thanks you for your helps.