Pre-install some apps so they can be uninstalled without root by user
Can I (As an AOSP builder) pre install some apps so after burning on device, they can easily be uninstalled (like regular downloaded apps)?
I am already familiar with system apps and priv-apps but as they lie in system partition they can not be removed! (only disabled in settings menu)
P.S. I know huawei for example uses /system/delapp to install such apps. But I seek for a general way or for AMLogic platform specifically which I am working on!
android-source android-7.1-nougat
add a comment |
Can I (As an AOSP builder) pre install some apps so after burning on device, they can easily be uninstalled (like regular downloaded apps)?
I am already familiar with system apps and priv-apps but as they lie in system partition they can not be removed! (only disabled in settings menu)
P.S. I know huawei for example uses /system/delapp to install such apps. But I seek for a general way or for AMLogic platform specifically which I am working on!
android-source android-7.1-nougat
An app is removable only if it is in /data. So I got an idea, install all the apps you want on a device and make the data partition an image. But this may not as easy what I think.
– reavenisadesk
Nov 29 '18 at 15:32
I think this not the way other vendors try to put their apps... @reavenisadesk
– Saleh
Nov 29 '18 at 20:46
add a comment |
Can I (As an AOSP builder) pre install some apps so after burning on device, they can easily be uninstalled (like regular downloaded apps)?
I am already familiar with system apps and priv-apps but as they lie in system partition they can not be removed! (only disabled in settings menu)
P.S. I know huawei for example uses /system/delapp to install such apps. But I seek for a general way or for AMLogic platform specifically which I am working on!
android-source android-7.1-nougat
Can I (As an AOSP builder) pre install some apps so after burning on device, they can easily be uninstalled (like regular downloaded apps)?
I am already familiar with system apps and priv-apps but as they lie in system partition they can not be removed! (only disabled in settings menu)
P.S. I know huawei for example uses /system/delapp to install such apps. But I seek for a general way or for AMLogic platform specifically which I am working on!
android-source android-7.1-nougat
android-source android-7.1-nougat
edited Dec 13 '18 at 20:17
Saleh
asked Nov 21 '18 at 15:51
SalehSaleh
415520
415520
An app is removable only if it is in /data. So I got an idea, install all the apps you want on a device and make the data partition an image. But this may not as easy what I think.
– reavenisadesk
Nov 29 '18 at 15:32
I think this not the way other vendors try to put their apps... @reavenisadesk
– Saleh
Nov 29 '18 at 20:46
add a comment |
An app is removable only if it is in /data. So I got an idea, install all the apps you want on a device and make the data partition an image. But this may not as easy what I think.
– reavenisadesk
Nov 29 '18 at 15:32
I think this not the way other vendors try to put their apps... @reavenisadesk
– Saleh
Nov 29 '18 at 20:46
An app is removable only if it is in /data. So I got an idea, install all the apps you want on a device and make the data partition an image. But this may not as easy what I think.
– reavenisadesk
Nov 29 '18 at 15:32
An app is removable only if it is in /data. So I got an idea, install all the apps you want on a device and make the data partition an image. But this may not as easy what I think.
– reavenisadesk
Nov 29 '18 at 15:32
I think this not the way other vendors try to put their apps... @reavenisadesk
– Saleh
Nov 29 '18 at 20:46
I think this not the way other vendors try to put their apps... @reavenisadesk
– Saleh
Nov 29 '18 at 20:46
add a comment |
1 Answer
1
active
oldest
votes
You can do that by configuring your build to produce a userdata.img
file with your app(s) included, which you can then flash with fastboot flash userdata
.
The Android.mk
file for these apps that go in userdata.img
roughly looks like the following:
include $(CLEAR_VARS)
LOCAL_MODULE := myapp1
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/app
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
And add the apps to product packages in device.mk
:
PRODUCT_PACKAGES += myapp1 myapp2 ...
You should be able to find plenty of examples on GitHub, e.g., https://github.com/search?l=Makefile&q=TARGET_OUT_DATA+BUILD_PREBUILT&type=Code
Since you are building the image from scratch, you can put your apps in a custom directory under and package a script to install them on boot time if they are not already installed. You can invoke that script by editing the init.rc
file as follows:
on property:dev.bootcomplete=1
exec - system system -- /system/bin/sh /path/to/installer/script.sh
The installer script can be as simple as:
for apkfile in /path/to/custom/apps/*.apk; do
/system/bin/pm install "$apkfile"
done
Can you please explain how to create userdata.img ? and also how to pack this new partition with other partitions when packing image in AOSP build environment
– Saleh
Dec 6 '18 at 23:07
Just add that make file and callmake
as usual and it will generate the userdata.img partition for you (because ofBUILD_PREBUILT
and$TARGET_OUT_DATA
). You pack it along with other partitions as usual (system.img, userdata.img, recovery.img, etc., in same directory).
– John
Dec 7 '18 at 22:41
I saw userdata.img and for now I don't know exactly how to pack this new partition with other ones (Because the default AOSP behavior is to not pack this partition into final image).... But anyway this solution at its ultimate is not perfect. Because once user does a factory reset the app is gone! (because there is not a version of APK in system partition to install it at first boot) @John
– Saleh
Dec 13 '18 at 19:50
That is how it is supposed to work. You cannot make user data survive factory resets. What you can do instead is pack a 'stub' app with system.img, put the full app on the play store, and make the stub app prompt the user to update to the full app. Check for example how Facebook ships a stub app on some devices.
– John
Dec 13 '18 at 20:00
But huawei instead used this patent to handle the problem more elegantly. you can uninstall apps preinstalled but they go back if you do a factory reset!
– Saleh
Dec 13 '18 at 20:07
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415804%2fpre-install-some-apps-so-they-can-be-uninstalled-without-root-by-user%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do that by configuring your build to produce a userdata.img
file with your app(s) included, which you can then flash with fastboot flash userdata
.
The Android.mk
file for these apps that go in userdata.img
roughly looks like the following:
include $(CLEAR_VARS)
LOCAL_MODULE := myapp1
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/app
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
And add the apps to product packages in device.mk
:
PRODUCT_PACKAGES += myapp1 myapp2 ...
You should be able to find plenty of examples on GitHub, e.g., https://github.com/search?l=Makefile&q=TARGET_OUT_DATA+BUILD_PREBUILT&type=Code
Since you are building the image from scratch, you can put your apps in a custom directory under and package a script to install them on boot time if they are not already installed. You can invoke that script by editing the init.rc
file as follows:
on property:dev.bootcomplete=1
exec - system system -- /system/bin/sh /path/to/installer/script.sh
The installer script can be as simple as:
for apkfile in /path/to/custom/apps/*.apk; do
/system/bin/pm install "$apkfile"
done
Can you please explain how to create userdata.img ? and also how to pack this new partition with other partitions when packing image in AOSP build environment
– Saleh
Dec 6 '18 at 23:07
Just add that make file and callmake
as usual and it will generate the userdata.img partition for you (because ofBUILD_PREBUILT
and$TARGET_OUT_DATA
). You pack it along with other partitions as usual (system.img, userdata.img, recovery.img, etc., in same directory).
– John
Dec 7 '18 at 22:41
I saw userdata.img and for now I don't know exactly how to pack this new partition with other ones (Because the default AOSP behavior is to not pack this partition into final image).... But anyway this solution at its ultimate is not perfect. Because once user does a factory reset the app is gone! (because there is not a version of APK in system partition to install it at first boot) @John
– Saleh
Dec 13 '18 at 19:50
That is how it is supposed to work. You cannot make user data survive factory resets. What you can do instead is pack a 'stub' app with system.img, put the full app on the play store, and make the stub app prompt the user to update to the full app. Check for example how Facebook ships a stub app on some devices.
– John
Dec 13 '18 at 20:00
But huawei instead used this patent to handle the problem more elegantly. you can uninstall apps preinstalled but they go back if you do a factory reset!
– Saleh
Dec 13 '18 at 20:07
|
show 4 more comments
You can do that by configuring your build to produce a userdata.img
file with your app(s) included, which you can then flash with fastboot flash userdata
.
The Android.mk
file for these apps that go in userdata.img
roughly looks like the following:
include $(CLEAR_VARS)
LOCAL_MODULE := myapp1
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/app
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
And add the apps to product packages in device.mk
:
PRODUCT_PACKAGES += myapp1 myapp2 ...
You should be able to find plenty of examples on GitHub, e.g., https://github.com/search?l=Makefile&q=TARGET_OUT_DATA+BUILD_PREBUILT&type=Code
Since you are building the image from scratch, you can put your apps in a custom directory under and package a script to install them on boot time if they are not already installed. You can invoke that script by editing the init.rc
file as follows:
on property:dev.bootcomplete=1
exec - system system -- /system/bin/sh /path/to/installer/script.sh
The installer script can be as simple as:
for apkfile in /path/to/custom/apps/*.apk; do
/system/bin/pm install "$apkfile"
done
Can you please explain how to create userdata.img ? and also how to pack this new partition with other partitions when packing image in AOSP build environment
– Saleh
Dec 6 '18 at 23:07
Just add that make file and callmake
as usual and it will generate the userdata.img partition for you (because ofBUILD_PREBUILT
and$TARGET_OUT_DATA
). You pack it along with other partitions as usual (system.img, userdata.img, recovery.img, etc., in same directory).
– John
Dec 7 '18 at 22:41
I saw userdata.img and for now I don't know exactly how to pack this new partition with other ones (Because the default AOSP behavior is to not pack this partition into final image).... But anyway this solution at its ultimate is not perfect. Because once user does a factory reset the app is gone! (because there is not a version of APK in system partition to install it at first boot) @John
– Saleh
Dec 13 '18 at 19:50
That is how it is supposed to work. You cannot make user data survive factory resets. What you can do instead is pack a 'stub' app with system.img, put the full app on the play store, and make the stub app prompt the user to update to the full app. Check for example how Facebook ships a stub app on some devices.
– John
Dec 13 '18 at 20:00
But huawei instead used this patent to handle the problem more elegantly. you can uninstall apps preinstalled but they go back if you do a factory reset!
– Saleh
Dec 13 '18 at 20:07
|
show 4 more comments
You can do that by configuring your build to produce a userdata.img
file with your app(s) included, which you can then flash with fastboot flash userdata
.
The Android.mk
file for these apps that go in userdata.img
roughly looks like the following:
include $(CLEAR_VARS)
LOCAL_MODULE := myapp1
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/app
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
And add the apps to product packages in device.mk
:
PRODUCT_PACKAGES += myapp1 myapp2 ...
You should be able to find plenty of examples on GitHub, e.g., https://github.com/search?l=Makefile&q=TARGET_OUT_DATA+BUILD_PREBUILT&type=Code
Since you are building the image from scratch, you can put your apps in a custom directory under and package a script to install them on boot time if they are not already installed. You can invoke that script by editing the init.rc
file as follows:
on property:dev.bootcomplete=1
exec - system system -- /system/bin/sh /path/to/installer/script.sh
The installer script can be as simple as:
for apkfile in /path/to/custom/apps/*.apk; do
/system/bin/pm install "$apkfile"
done
You can do that by configuring your build to produce a userdata.img
file with your app(s) included, which you can then flash with fastboot flash userdata
.
The Android.mk
file for these apps that go in userdata.img
roughly looks like the following:
include $(CLEAR_VARS)
LOCAL_MODULE := myapp1
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/app
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
And add the apps to product packages in device.mk
:
PRODUCT_PACKAGES += myapp1 myapp2 ...
You should be able to find plenty of examples on GitHub, e.g., https://github.com/search?l=Makefile&q=TARGET_OUT_DATA+BUILD_PREBUILT&type=Code
Since you are building the image from scratch, you can put your apps in a custom directory under and package a script to install them on boot time if they are not already installed. You can invoke that script by editing the init.rc
file as follows:
on property:dev.bootcomplete=1
exec - system system -- /system/bin/sh /path/to/installer/script.sh
The installer script can be as simple as:
for apkfile in /path/to/custom/apps/*.apk; do
/system/bin/pm install "$apkfile"
done
edited Jan 8 at 18:45
answered Dec 6 '18 at 20:48
JohnJohn
673413
673413
Can you please explain how to create userdata.img ? and also how to pack this new partition with other partitions when packing image in AOSP build environment
– Saleh
Dec 6 '18 at 23:07
Just add that make file and callmake
as usual and it will generate the userdata.img partition for you (because ofBUILD_PREBUILT
and$TARGET_OUT_DATA
). You pack it along with other partitions as usual (system.img, userdata.img, recovery.img, etc., in same directory).
– John
Dec 7 '18 at 22:41
I saw userdata.img and for now I don't know exactly how to pack this new partition with other ones (Because the default AOSP behavior is to not pack this partition into final image).... But anyway this solution at its ultimate is not perfect. Because once user does a factory reset the app is gone! (because there is not a version of APK in system partition to install it at first boot) @John
– Saleh
Dec 13 '18 at 19:50
That is how it is supposed to work. You cannot make user data survive factory resets. What you can do instead is pack a 'stub' app with system.img, put the full app on the play store, and make the stub app prompt the user to update to the full app. Check for example how Facebook ships a stub app on some devices.
– John
Dec 13 '18 at 20:00
But huawei instead used this patent to handle the problem more elegantly. you can uninstall apps preinstalled but they go back if you do a factory reset!
– Saleh
Dec 13 '18 at 20:07
|
show 4 more comments
Can you please explain how to create userdata.img ? and also how to pack this new partition with other partitions when packing image in AOSP build environment
– Saleh
Dec 6 '18 at 23:07
Just add that make file and callmake
as usual and it will generate the userdata.img partition for you (because ofBUILD_PREBUILT
and$TARGET_OUT_DATA
). You pack it along with other partitions as usual (system.img, userdata.img, recovery.img, etc., in same directory).
– John
Dec 7 '18 at 22:41
I saw userdata.img and for now I don't know exactly how to pack this new partition with other ones (Because the default AOSP behavior is to not pack this partition into final image).... But anyway this solution at its ultimate is not perfect. Because once user does a factory reset the app is gone! (because there is not a version of APK in system partition to install it at first boot) @John
– Saleh
Dec 13 '18 at 19:50
That is how it is supposed to work. You cannot make user data survive factory resets. What you can do instead is pack a 'stub' app with system.img, put the full app on the play store, and make the stub app prompt the user to update to the full app. Check for example how Facebook ships a stub app on some devices.
– John
Dec 13 '18 at 20:00
But huawei instead used this patent to handle the problem more elegantly. you can uninstall apps preinstalled but they go back if you do a factory reset!
– Saleh
Dec 13 '18 at 20:07
Can you please explain how to create userdata.img ? and also how to pack this new partition with other partitions when packing image in AOSP build environment
– Saleh
Dec 6 '18 at 23:07
Can you please explain how to create userdata.img ? and also how to pack this new partition with other partitions when packing image in AOSP build environment
– Saleh
Dec 6 '18 at 23:07
Just add that make file and call
make
as usual and it will generate the userdata.img partition for you (because of BUILD_PREBUILT
and $TARGET_OUT_DATA
). You pack it along with other partitions as usual (system.img, userdata.img, recovery.img, etc., in same directory).– John
Dec 7 '18 at 22:41
Just add that make file and call
make
as usual and it will generate the userdata.img partition for you (because of BUILD_PREBUILT
and $TARGET_OUT_DATA
). You pack it along with other partitions as usual (system.img, userdata.img, recovery.img, etc., in same directory).– John
Dec 7 '18 at 22:41
I saw userdata.img and for now I don't know exactly how to pack this new partition with other ones (Because the default AOSP behavior is to not pack this partition into final image).... But anyway this solution at its ultimate is not perfect. Because once user does a factory reset the app is gone! (because there is not a version of APK in system partition to install it at first boot) @John
– Saleh
Dec 13 '18 at 19:50
I saw userdata.img and for now I don't know exactly how to pack this new partition with other ones (Because the default AOSP behavior is to not pack this partition into final image).... But anyway this solution at its ultimate is not perfect. Because once user does a factory reset the app is gone! (because there is not a version of APK in system partition to install it at first boot) @John
– Saleh
Dec 13 '18 at 19:50
That is how it is supposed to work. You cannot make user data survive factory resets. What you can do instead is pack a 'stub' app with system.img, put the full app on the play store, and make the stub app prompt the user to update to the full app. Check for example how Facebook ships a stub app on some devices.
– John
Dec 13 '18 at 20:00
That is how it is supposed to work. You cannot make user data survive factory resets. What you can do instead is pack a 'stub' app with system.img, put the full app on the play store, and make the stub app prompt the user to update to the full app. Check for example how Facebook ships a stub app on some devices.
– John
Dec 13 '18 at 20:00
But huawei instead used this patent to handle the problem more elegantly. you can uninstall apps preinstalled but they go back if you do a factory reset!
– Saleh
Dec 13 '18 at 20:07
But huawei instead used this patent to handle the problem more elegantly. you can uninstall apps preinstalled but they go back if you do a factory reset!
– Saleh
Dec 13 '18 at 20:07
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415804%2fpre-install-some-apps-so-they-can-be-uninstalled-without-root-by-user%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
An app is removable only if it is in /data. So I got an idea, install all the apps you want on a device and make the data partition an image. But this may not as easy what I think.
– reavenisadesk
Nov 29 '18 at 15:32
I think this not the way other vendors try to put their apps... @reavenisadesk
– Saleh
Nov 29 '18 at 20:46