How to block certain APK Installs automatically in Android AOSP Code? - Android Q&A, Help & Troubleshooting

Is there a way you can add apk package names to a file so when a user tries to install any of them, it fails with an error message that the app couldn't be installed?
Here is a patch for Android 10 but I don't know how to feed an external file eg. system/etc/blocked.xml to it so only those apps are blocked or fail to install but all other apps can still install normally.
Is there another way too to add the package names to block from being installed to the Android code itself so there isn't a system/etc/*.xml file they can see and easily delete.
Patch
https://pastebin.com/L892ntMP

Hi ,
Your pastebin link is not working can you please share the patch or the link again

dewettie said:
Is there a way you can add apk package names to a file so when a user tries to install any of them, it fails with an error message that the app couldn't be installed?
Here is a patch for Android 10 but I don't know how to feed an external file eg. system/etc/blocked.xml to it so only those apps are blocked or fail to install but all other apps can still install normally.
Is there another way too to add the package names to block from being installed to the Android code itself so there isn't a system/etc/*.xml file they can see and easily delete.
Patch
https://pastebin.com/L892ntMP
Click to expand...
Click to collapse
Can you please share the patch or the link again

If I remember this correctly, the signature of apk to be installed has to be the same as before if apk has been removed keeping the data. Now, rewrite the signature of the apk and install it and then uninstall keeping the data. That might make it harder to install that app in future...

Related

[Q] Sideloading Archiving and Unarchiving?

I've only started trying to sideload after only being rooted with the CWM Root.. I've watched the tutorials from Albert on Youtube and have read numerous posts on here on sideloading, If I'm only missing a program or something I'm gonna be a little embarrassed but right now I can't seem to get any APK to install on my NT..
So far I have downloaded the ES File Explorer, I've sent my APK files over to a file that I have created to store them and have tried to open them using the ES File Explorer, and I keep getting the same error ("Unable to Install" This application was not able to instal on your device. Please "Archive" and then "Unarchive" the application to try again.) Then my APK file is no longer on my tablet.. I have to reload it from the PC and try again.. with the same results.
Also I have tried the download method for the APK files in which he showed with the same error and results..
If you have seen this and is easy I applogize for the incovenience, but I have been unable to find this on the forums..
Thank you Much..
You are opening it with the wrong package installer, B&N has their own package installer, and it's being opened with that instead of the Android one.
The bigger problem is once it's viewed as "incompatible" it's deleted by B&N's so it would need to be put back on the device.
Your default may be set incorrectly if you don't get a prompt to ask which package installer.
DemonicPhantasm said:
You are opening it with the wrong package installer, B&N has their own package installer, and it's being opened with that instead of the Android one.
The bigger problem is once it's viewed as "incompatible" it's deleted by B&N's so it would need to be put back on the device.
Your default may be set incorrectly if you don't get a prompt to ask which package installer.
Click to expand...
Click to collapse
That would make sense that I'm opening it with the wrong installer. Where am I going to find the other package installers and set them as my default??
Also I've Downloaded APK installers from the Android Market and hae tried those as well but getting incompatible errors with those as well..

Download & Install The Unreleased Gmail 4.2 APK With Pinch-To-Zoom And More

You will find here the new Unreleased Gmail 4.2.apk - Thanks to Android Police for this news
The Gmail 4.2 APK is signed by Google, but with a different key than the one in the Play Store (we checked the signatures - they differ). One is probably the test key and the other the production key. For this reason, you can't simply install it as an update and therefore need to be rooted with the ability to mount the /system directory for writing in order to remove the existing Gmail APK.
Important: Once Google updates Gmail in the Play Store, you will want to revert this process or at the very least delete the Gmail 4.2 APK you installed here if you want to update it from the Play Store.
OK, let's get down to it. You'll probably need ADB installed on your computer (here's an easy way that doesn't require downloading the Android SDK). There is a chance that this might work without ADB by just removing the APKs mentioned below and installing the new one, but it didn't seem to work reliably for everyone. This should, though:
- Download Gmail 4.2 from the download link above.
- Rename it to Gmail2.apk.(already renamed )
- Make a Nandroid backup in case something goes wrong (this is always a good thing to do before messing with your device).
- Remount /system for writing (via your favorite root-aware file explorer).
- Delete (or move if you want to save the APKs) all other versions of Gmail.
- Update: We've seen multiple successful reports of simply uninstalling Gmail using Titanium Backup or ROM Toolbox instead of performing this and the next step. If that works for you, go directly to step 7. If not, proceed below.
- Usually there are 2 or 3 copies. One will be in /system/app (that's the original Gmail that was pre-installed on the device) and there may be a few in /data/app (these are the updates installed from the Play Store). They'll be called "Gmail.apk," or "com.google.android.gm-[number].apk," An easy way to tell is to look for the Gmail icon.
- You may need to delete the .odex files matching the APKs in step 5 too, if you have them. Neither I nor Artem had to do this, but there are many different ROMs out there, and we're trying to cover all bases. Ignore this step and only come back to it if something doesn't work later.
- Reboot. Once you do, you should have no Gmail as far as Android is concerned.
- You can try to install the Gmail 4.2 APK you downloaded at this point by tapping it in your favorite file explorer (move the APK to your device first, of course). If that doesn't work, or if you prefer ADB, fire up a command line and type adb install Gmail2.apk.
If you get an error message, you probably didn't delete all copies of Gmail. If you don't feel like playing with ADB for Step 8, I've also gotten it to work by just copying the APK to /data/app, but that's not as fool proof as "ADB install".
Click to expand...
Click to collapse
Gmail 4.2.apk - download link - MD5 Sum: 2e5dbfccea5fca470d1e669fc0f431ba - Size: 2.77 MB (2906222 bytes)
Source [androidpolice]

[Q] [HELP!!] Deleted some odex, now no more apk installer

Was trying to install some APK manually then i got a "LOW STORAGE SPACE" warning. Check online, was 'guided' to delete some .odex file.
I think i deleted some wrong files but I can't remember which. After deleting the .odex, I was able to install the APK I wanted to install.
But now, which is few hours later with a few reboot done to my phone. I can't use Google Play (getting error 406), I can't manually install APK which I transferred from my notebook. When I try to open the APK file (and few others which previously worked) via Root Explorer or File Commander both apps return the similar warning, somethings that says "there are no apps capable of opening this kind of file"
Any help here?
ed0gawa said:
Was trying to install some APK manually then i got a "LOW STORAGE SPACE" warning. Check online, was 'guided' to delete some .odex file.
I think i deleted some wrong files but I can't remember which. After deleting the .odex, I was able to install the APK I wanted to install.
But now, which is few hours later with a few reboot done to my phone. I can't use Google Play (getting error 406), I can't manually install APK which I transferred from my notebook. When I try to open the APK file (and few others which previously worked) via Root Explorer or File Commander both apps return the similar warning, somethings that says "there are no apps capable of opening this kind of file"
Any help here?
Click to expand...
Click to collapse
from your question I guess it is the packageinstaller.apk/odex you deleted but not sure
with out the name of the files you deleted you cant get it to work
so simply reflash the rom
sangalaxy said:
from your question I guess it is the packageinstaller.apk/odex you deleted but not sure
with out the name of the files you deleted you cant get it to work
so simply reflash the rom
Click to expand...
Click to collapse
Well, reflash after trying various ways...
Thanks anyway

Renaming APK package

Hi,
I have an issue. I need to install an APK, that’s already install on the phone (old version). As this APK is install by default in the phone by Sony, I can’t remove it ( I could root my phone to remove it but I don’t want (for many reasons…)). Installation failed because of conflicting name.
My question is: How I could rename the new APK (deep inside the APK), not just the file name, to avoid conflicting name?
Thanks
KR
I think this is not possible, unless you have the source code, change the package name and recompile the app. Usual behavior should be that a pre-installed app can be updated. Wondering why this does not work on your phone.

Modify apk

Is theres a way to modify and run this apks without unlocking secrecy or auth token? i pulled it from my oppo and when i run the app it'll update the existing app
norimee said:
Is theres a way to modify and run this apks without unlocking secrecy or auth token? i pulled it from my oppo and when i run the app it'll update the existing app
Click to expand...
Click to collapse
You can't modify an APK, as it's in binary. You could remove it though - Let me know if you need help.
An APK ( read: Android Application Package ) file by nature is a ZIP file - not a binray - what can get extracted with any zip utility (e.g. 7zip), you can view all resources correctly but all java files are not correctly decompiled.
Content of an APK file looks like
You can also see the contents of an APK file within the Android device itself, which helps a lot in debugging, using
https://play.google.com/store/apps/details?id=com.dasmic.android.apkpeek
All files including the manifest of an app can be viewed and also shared using email, cloud etc., no rooting required.

Categories

Resources