0

In our company we want to change device date and time from app for a requirement. That app will be running on a dedicated android device which has custom ROM given by the manufacturer. In order to acieve that I'm trying to sign our app with manufacturer keys as below.

java -jar signapk.jar platform.x509.pem platform.pk8 old.apk new.apk

But it doesn't work. If I verify with below code it says the app is not a system app.

public boolean isSystemApp(String packageName) {
        final String SYSTEM_PACKAGE_NAME = "android";
        PackageManager mPackageManager = (PackageManager) getPackageManager();
        try {
            // Get packageinfo for target application
            PackageInfo targetPkgInfo = mPackageManager.getPackageInfo(
                    packageName, PackageManager.GET_SIGNATURES);
            // Get packageinfo for system package
            PackageInfo sys = mPackageManager.getPackageInfo(
                    SYSTEM_PACKAGE_NAME, PackageManager.GET_SIGNATURES);
            // Match both packageinfo for there signatures
            return (targetPkgInfo != null && targetPkgInfo.signatures != null && sys.signatures[0]
                    .equals(targetPkgInfo.signatures[0]));
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }

Also,as suggested here, If I add android:sharedUserId="android.uid.system" in manifest I cannot install my app as it says "The package conflicts with an existing package by the same name".

Is there anything I'm missing here? Kindly someone help me to solve this. Thanks.

Kamal
  • 335
  • 3
  • 10

1 Answers1

1

It was my mistake to not analyze it further, I tried installing it with adb install -r ".apk" and found the exact error, which is "signatures are not matching". Then I contacted the manufacturer and the problem was solved.

Kamal
  • 335
  • 3
  • 10