How to sign my application so I can install it as an system application?
I generate apk. And then i type these commands in terminal:
adb remount
adb push app-debug.apk /system/app/
adb shell chmod 644 /system/app/app-debug.apk
adb reboot
Ofc, i have root on my phone. Is LG G2.
After finish rebooting phone the app is exist and i can't uninstall it so i think that is from now system app. But..
/**
* Match signature of application to identify that if it is signed by system
* or not.
*
* @param packageName
* package of application. Can not be blank.
* @return <code>true</code> if application is signed by system certificate,
* otherwise <code>false</code>
*/
public boolean isSystemApp(String packageName) {
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;
}
}
Above function return false when i run it with my app package. And also i still getting error:
java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
Ofc, i have added INJECT_EVENTS permission in android manifest. I need it to simulate touch and simulate key press from my service to other apps.
Am I doing something wrong?