Dror Avraham
Jan 29, 2019
10:55 am

addHomeShortcutToPersonal return false

Hi All,

 

While trying to use addHomeShortcutToPersonal from within the container (tried also from outside the container) I receive false as response.

Android O and Android P (J6 and S9).

Any idea what am I doing wrong?

Code:

String pkgName = "com.sec.android.app.camera";
String clsName = null;
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
    KnoxContainerManager containerMgr = ekm.getKnoxContainerManager(containerID);
    ContainerConfigurationPolicy ccp = containerMgr.getContainerConfigurationPolicy();
    boolean result = ccp.addHomeShortcutToPersonal(pkgName, clsName);
    if (result == true) {
        Toast.makeText(this, Boolean.toString(result), Toast.LENGTH_LONG).show();
        Log.d(TAG, "addHomeShortcut has succeeded!");
    } else {
        Toast.makeText(this, Boolean.toString(result), Toast.LENGTH_LONG).show();
        Log.d(TAG, "addHomeShortcut has failed.");
    }
} catch (SecurityException e) {
    Toast.makeText(this,"E:"+ e, Toast.LENGTH_LONG).show();
    Log.w(TAG, "SecurityException: " + e);
}

 

Update:

Same code creates the shortcut on Android M

Updated: Jan 29, 2019 1:22 pm

Mikayla N.Samsung SEAP Moderator
Feb 02, 2019
12:05 am

Hi Dror,

This seems to be an issue. When I run this code I receive a "package name mismatch" exception. Could you reproduce the issue, capture a dumpstate and see if there are any exceptions when the app fails to add the shortcut? I have provided the instructions on how to capture a dumpstate below, in case you are unaware. Once we know exactly what kind of exception you are receiving we can investigate this further. 

 

How to create a log file:

1) In the Phone Application, enter *#9900#

2) Set the "Debug Level" to High. The device will restart

3) Reproduce the issue

4) After reproducing your issue, enter *#9900# again in the Phone Application

5) Select "Run dumpstate/logcat"

6) Select "Copy to sdcard"

7) Navigate to the "log" directory that was created on the device using the "My Files" app or a Windows PC with USB cable connection

8) Open the log file and search for the line: "addHomeShortcut has failed"

9) Comment that line and any exceptions you see on this post

After you have finished, you can follow steps 1-2 again and Delete dumpstate/logcat and return the Debug Level to "low."

 

If you have any questions about this process, please let me know.

Best,

Mikayla

Dror Avraham
Feb 02, 2019
11:57 am

Thank you Mikayla,

In the log I also see the package name mismatch. What am I doing wrong?

log:

02-02 13:38:54.318  1000  3240  3991 I KnoxMUMContainerPolicy:  addShortcutToPersonal:17

02-02 13:38:54.319  1000  3240  3991 D EnterpriseDeviceManagerService: Creating context as user 17

02-02 13:38:54.341  1000  3240  3991 I KnoxMUMContainerPolicy:  label:Chrome,pkgName:com.android.chrome,userid17

02-02 13:38:54.342  1000  3240  3991 E KnoxMUMContainerPolicy: Exception occurred while adding home shortcut Shortcut package name mismatch

02-02 13:38:54.342  1000  3240  3991 W System.err: java.lang.SecurityException: Shortcut package name mismatch

02-02 13:38:54.343  1000  3240  3687 D StorageManagerService: getExternalStorageMountMode : 3

02-02 13:38:54.343  1000  3240  3991 W System.err: at com.android.server.pm.ShortcutService.verifyShortcutInfoPackage(ShortcutService.java:1616)

02-02 13:38:54.343  1000  3240  3991 W System.err: at com.android.server.pm.ShortcutService.createShortcutResultIntent(ShortcutService.java:1968)

02-02 13:38:54.343  1000  3240  3991 W System.err: at com.android.server.enterprise.container.KnoxMUMContainerPolicy.addShortcutToPersonal(KnoxMUMContainerPolicy.java:7593)

02-02 13:38:54.343  1000  3240  3991 W System.err: at com.android.server.enterprise.container.KnoxMUMContainerPolicy.addHomeShortcutToPersonal(KnoxMUMContainerPolicy.java:7635)

02-02 13:38:54.343  1000  3240  3991 W System.err: at com.samsung.android.knox.container.IKnoxContainerManager$Stub.onTransact(IKnoxContainerManager.java:848)

Mikayla N.Samsung SEAP Moderator
Feb 04, 2019
6:18 pm

Hi Dror,

Thank you for confirming the problem you are experiencing. We are looking into this issue. I will update you as soon as I have more information for you.

Best regards,

Mikayla

Dror Avraham
Feb 12, 2019
2:57 pm

Hello,

Any update on this issue?

Comments

Hi Dror,

We are still investigating this issue. If I require additional information from you, I will let you know. I will update you if I have any new information.

Best,

Mikayla

Mikayla N.Feb 12, 2019 at 10:26 pm