Moving system apk from stock 4.0 to CM 11 - Android Q&A, Help & Troubleshooting

Hi,
I got CM 11 running on my devices (Nexus Q) and want to add some system apk from the stock factory images and need some help. I mounted the factory image and copied TungstenLEDService.apk from /system/app to my computer and tried to install it over adb. This is what I have done so far.
Code:
adb install TungstenLEDService.apk
but it fails with INSTALL_FAILED_SHARED_USER_INCOMPATIBLE error. Ok fine, its a system apk, so I did the following.
I enabled root over adb on developer settings on the device and from the terminal I did
Code:
adb push TungstenLEDService.apk /sdcard/
adb shell
su
mount -o rw,remount -t ext4 /system
cp /sdcard/TungstenLEDService.apk /system/app/
And then I set the permission with Solid Explorer filemanager to -rw-r--r-- on TungstenLEDService.apk and rebooted. From logcat I got this error
Code:
Package com.google.tungsten.ledservice has no signatures that match those in shared user android.uid.system; ignoring!
What to do next? Do I need to resign the apk? How do I do that? I have not modified the apk in any way and the CM 11 build is from this xda thread: http://forum.xda-developers.com/showthread.php?t=2596910

mannberg said:
Hi,
I got CM 11 running on my devices (Nexus Q) and want to add some system apk from the stock factory images and need some help. I mounted the factory image and copied TungstenLEDService.apk from /system/app to my computer and tried to install it over adb. This is what I have done so far.
Code:
adb install TungstenLEDService.apk
but it fails with INSTALL_FAILED_SHARED_USER_INCOMPATIBLE error. Ok fine, its a system apk, so I did the following.
I enabled root over adb on developer settings on the device and from the terminal I did
Code:
adb push TungstenLEDService.apk /sdcard/
adb shell
su
mount -o rw,remount -t ext4 /system
cp /sdcard/TungstenLEDService.apk /system/app/
And then I set the permission with Solid Explorer filemanager to -rw-r--r-- on TungstenLEDService.apk and rebooted. From logcat I got this error
Code:
Package com.google.tungsten.ledservice has no signatures that match those in shared user android.uid.system; ignoring!
What to do next? Do I need to resign the apk? How do I do that? I have not modified the apk in any way and the CM 11 build is from this xda thread: http://forum.xda-developers.com/showthread.php?t=2596910
Click to expand...
Click to collapse
3 things that are probably causing issues.
1) it's a signed factory apk, and is looking for a factory rom to work on. You can try re-signing it using basic "test" signature. Also, make sure the apk is "deodexed".
2) Just incompatible with version 4.4 KitKat. In this case, you would probably have to re-write a lot of code.
3) Decompile and check the Android Manifest for anything unusual. Also, while decompiled, check all the folders for the last error message you posted. Might be a clue in there.

Moscow Desire said:
1) it's a signed factory apk, and is looking for a factory rom to work on. You can try re-signing it using basic "test" signature. Also, make sure the apk is "deodexed".
Click to expand...
Click to collapse
How do I deodex the apk / odex files? Any good and easy guides out there? Im a neewbie. Tell me like I'm 4 years old The apk / odex files is from android version 4.0.4
Signing with test signature, do you mean something like this
Code:
jarsigner -keystore ~/.android/debug.keystore -storepass android -keypass android TungstenLEDService.apk androiddebugkey
after the apk is deodoxed?
Moscow Desire said:
2) Just incompatible with version 4.4 KitKat. In this case, you would probably have to re-write a lot of code.
Click to expand...
Click to collapse
I hope not.
Moscow Desire said:
3) Decompile and check the Android Manifest for anything unusual. Also, while decompiled, check all the folders for the last error message you posted. Might be a clue in there.
Click to expand...
Click to collapse
I didnt see anything special in the Manifest, it looks like the one I posted below. Do I need to change android:versionCode and android:versionName?
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest android:sharedUserId="android.uid.system" android:versionCode="15" android:versionName="4.0.4-403218" package="com.google.tungsten.ledservice"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<application android:label="Tungsten LED Service">
<service android:name=".LEDService" android:exported="true">
<intent-filter>
<action android:name="com.google.tungsten.LedService" />
</intent-filter>
</service>
<receiver android:name="BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="com.google.tungsten.ledservice.TungstenLedContainer" android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="com.android.athome.START_SERVICE" />
</intent-filter>
<meta-data android:name="com.android.athome.service" android:resource="@xml/connector_info" />
</service>
</application>
</manifest>

mannberg said:
How do I deodex the apk / odex files? Any good and easy guides out there? Im a neewbie. Tell me like I'm 4 years old The apk / odex files is from android version 4.0.4
Click to expand...
Click to collapse
Ha! Can't do that mate. Have to work!
Now, here is what I use for pretty much all my needs when it comes to working with apks and other things.
http://forum.xda-developers.com/showthread.php?t=1619473
They have a pretty good support here at XDA, and also their own website. This saves you having to find all these apktools and such for decompiling, deodexing and stuff, which is a real pain. I use it under Win 7. Might have to install the latest version of Microsoft.net though.
First thing, is make sure your apk is deodexed or not. If it's not, you will see an odex file with the same name in your system folder of your old 4.0.4 files. If it's not, you'll need to deodex it before decompiling. If there's not an odex file, then you can go straight to decompiling. Then, you can look in all the folders and such. Then recompile it back, using the test keys for signing.
As with the manifest, it's possible you need to change the android versions. But the message you had, seems to be looking for something signed specifically for that 4.0.4. Probably a factory signed framework or systemUI.
CM uses unsigned files, or files signed using random testkeys.
You can also check XDA University about porting apps to KitKat. Lots of these folks do this, and port to other devices, so hopefully somebody there can tell you more. Or check the General Android Application Development forums.
MD

I dedoxed the apk and odex files. Changed the manifest and removed the sharedUserId and rebuilt the apk, signed with a test key. Then I copied the the apk to /system/app. So far everything is fine.
I tried to launch the service (tungsten.ledservice) with
Code:
adb shell am startservice -n com.google.tungsten.ledservice/.TungstenLedContainer
and when I check ps in adb shell I see a process called com.google.tungsten.ledservice. But nothing happens when I change the volyme. It should change the leds on the Nexus Q. I checked adb logcat and found this in the log.
Code:
D/AndroidRuntime( 2626):
D/AndroidRuntime( 2626): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 2626): CheckJNI is OFF
D/dalvikvm( 2626): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 2626): Added shared lib libjavacore.so 0x0
D/dalvikvm( 2626): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 2626): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 2626): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
E/cutils-trace( 2626): Error opening trace file: No such file or directory (2)
D/dalvikvm( 2626): Note: class Landroid/app/ActivityManagerNative; has 180 unimplemented (abstract) methods
E/memtrack( 2626): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 2626): failed to load memtrack module: -2
D/AndroidRuntime( 2626): Calling main entry com.android.commands.am.Am
D/AndroidRuntime( 2626): Shutting down VM
This service use some library from /system/lib/, libled_service_jni.so and libtungsten_led.so. I guess some changes were made to the jni stuff between android 4.0.4 and 4.4. Is this fixable? Is it the java code that fails or the compiled c librarys?

Related

Editing AndroidManifest.xml .. formatting / localized to Chinese(?), Go SMS Pro Theme

Hi everyone,
I've created a GO SMS Pro theme using their webtool,
but it appears to have yet to implement various common aspects of functionality. I want to be able to modify the AndroidManifest.xml file myself, primarily to add Airpush (the presence of which I let people know of from the beginning), but the formatting is quite garbled. I'm guessing this may be due to the localization to Chinese that the Google Play developer console reports. Does anyone have a functional, readily editable version in English with all the required information for a GO SMS Pro Theme? I want to be assured I have all the required information, rather than hacking together another xml file with Eclipse. I figured I'd install the Chinese language on my computer, but it appears Microsoft did not include such functionality in Windows 7 Premium (64-bit). I've download other GO SMS Pro themes with Airpush, figuring I could use their AndroidManifest.xml and mail.xml files as templates, but found the same formatting / editability issue. Thank you for your help!
I've since found kantbstopped519's post at the end of page 3 in the following thread: http://forum.xda-developers.com/showthread.php?t=1125626&page=3
and used what was posted:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="5" android:versionName="1.0" android:installLocation="auto" package="com.jb.gosms.theme.kxnt.dark"
xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="@string/app_name" android:icon="@drawable/jb_smsmms">
<activity android:theme="@android:style/Theme.Dialog" android:label="@string/app_name_desc" android:name=".GoSmsInstallDialog" android:excludeFromRecents="true" android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
</intent-filter>
<intent-filter>
<action android:name="com.jb.mms.theme.others" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="4" />
</manifest>
Click to expand...
Click to collapse
It appears this functioned for kantbstopped519.
I used this as a template (made no additions of Airpush or anything such) and made the supposedly appropriate changes, also changing anything referencing @string to plain text directly in AndroidManifest.xml. Now I'm getting that informative "The server could not process your apk. Try again."
I've been making various changes, deletions, and resigning after each change, to repeatedly the same message. Only re-adding my original garbled-de-goop AndroidManifest.xml file and resigning has thus far resulted in a successful processing upon upload. Could this have something to do with the resources.arsc and/or classes.dex files in the root of the apk?
If the APK is already compiled then you will need to decompile it with apktool to get the XML readable.

[MOD][GUIDE] ICS+ Tabbed settings(MIUI Like)

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
So I came across this thread a week or more back and implemented it in my ICS rom, but I wasn't happy with it(various reasons but mostly because it is gesture based). So I abandoned it. Fast forward a couple days, jumping from project to project, idea to idea and I somehow ended up porting the latest ICS version of ShenduOS. Then boom, the settings app was *almost* exactly what I wanted. It featured a more natural swiping from tab to tab, similar to most launchers.
So I stripped the code for the tabs from the shendu settings app, stripped that code of any Shendu specific code and re-coded portions of the smali code so I could add it to the settings app of the ICS rom I use as my daily driver. What I ended up with is what seems to be something thats pretty generic and not rom specific.
So now I share with you what *should* work with any ICS+ rom. This guide will be very similar to the one I linked to above.
THIS SHOULD ALSO WORK ON OTHER DEVICES BUT I CANNOT TEST TO BE SURE
Prerequisites:
-experience decompiling/recompiling apk's with APKTool
-experience signing apks
-experience editing/theming apks
I will not go into any of the above any more then just saying when to preform certain actions......
GUIDE:
1. First you will need to decompile the Settings.apk from your ROM with apktool
2. Download the Settings.zip I attached to this post
3. Unzip the Settings.zip and copy the 'res' and 'smali' folders to your decompiled Settings.apk folder(merge with existing folders of the same names)
4. Open 'res/values/strings.xml' from the decompiled settings apk in your favorite text editor and add the following to the end of the list of strings...
Code:
<string name="personalized_setting">Personal</string>
<string name="device_setting">System</string>
<string name="app_setting">Applications</string>
5. Open 'res/values/ids.xml' from the decompiled settings apk in your favorite text editor and add the following to the end of the list of ID's
Code:
<item type="id" name="linearLayout1">false</item>
<item type="id" name="personalized_tab">false</item>
<item type="id" name="device_tab">false</item>
<item type="id" name="app_tab">false</item>
<item type="id" name="cursor">false</item>
<item type="id" name="vPager">false</item>
6.Now you must recompile the settings.apk. This is because APKtool will give resource ID's to certain resources we added during this process, we need these generated ID's in the following steps because the code access's some resources directly by the ID's.
7. Decompile the Newly recompiled APK again, from here on out I will assume your editing this newly recompiled/decompiled version.
8. With this step it is very easy to make a typo, so please make sure you are paying Extra attention to details during this step.
-Open up 'res/values/public.xml' and you will find lines similar to the following.
Code:
<public type="id" name="[COLOR="Red"]vPager[/COLOR]" id="[U]0x7f08022a[/U]" />
-Below I will give you a list of .smali file names, each file is located in the 'smali/com/android/settings/' folder of your decompiled settings.apk
- Each file name will be followed by a line similar to above, you need to search the smali files for the ID(underlined in the example above)
- Then search the public.xml I told you to open above for the name for each line(red in example above)
- Replace the ID in the smali file with the one you located in the public.xml
Code:
!--MainSettings.smali--!
<public type="id" name="vPager" id="0x7f08022a" />
<public type="id" name="cursor" id="0x7f080229" />
<public type="id" name="app_tab" id="0x7f080168" />
<public type="id" name="device_tab" id="0x7f080228" />
<public type="id" name="personalized_tab" id="0x7f080227" />
<public type="layout" name="mainsetting" id="0x7f040090" />
!--DeviceSettings.smali--!
<public type="xml" name="device_settings_headers" id="0x7f050051" />
!--AppSettings.smali--!
<public type="xml" name="app_settings_headers" id="0x7f050052" />
!--PersonalSettings.smali--!
<public type="xml" name="personal_settings_headers" id="0x7f050053" />
9. Now open up the 'AndroidManifest.xml' of your decompiled settings.apk in a text editor.
-Find a section similar to the below....
Code:
<activity android:label="@string/settings_label_launcher" android:name="Settings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The important parts you are looking for are 'name="Settings" and the 'android.intent.category.LAUNCHER' lines, there *should* only be a single section with these.
Change this section to the below:
Code:
<activity android:label="@string/settings_label_launcher" android:name="Settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Directly above that section copy/paste the following code:
Code:
<activity android:name="MainSetting" android:theme="@android:style/Theme.NoTitleBar" android:taskAffinity="com.android.settings" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="@string/settings_label_launcher" android:name="PersonalSettings" android:taskAffinity="com.android.settings" android:launchMode="singleTask">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:label="@string/settings_label_launcher" android:name="DeviceSettings" android:taskAffinity="com.android.settings" android:launchMode="singleTask">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:label="@string/settings_label_launcher" android:name="AppSettings" android:taskAffinity="com.android.settings" android:launchMode="singleTask">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
10. You are now done with this round of modifications, its time to recompile the APK. Because this is a system app and we edited AndroidManifest.xml we must sign this recompiled Apk before pushing it to the system. You can try using any of the keys that come with whatever apk signing tool you use, but you will more then likely end up with a Settings.apk that wont show as being installed. To overcome this on ASOP roms I download and sign system apks with the platfrom keys from CyanogenMod's android_build github. If everything goes well and you push the new signed apk to the system, your settings app should now look similar to this when you open it.
11. What you have is 3 tabs with no settings. I left this for you to do, as each rom has its own specific settings options. Most ASOP roms store the main page of settings options in the 'res/xml/settings_headers.xml'. Copy/paste/reorganize each of these options into the 'app_settings_headers.xml', 'device_settings_headers.xml' and 'personal_settings_headers.xml' files which are also located in 'res/xml/'.
12. After all is said and done above, you *may* need to edit/theme the 'res/layout/mainsettings.xml' to suit your roms specific look.
NOTE:
If you are attempting this on a Non-ASOP Rom or are having trouble you may need to follow these additional instructions
And to finally end this, here are some screenshots where I added this feature to the settings.apk of our twistedmodICS rom by pwn.
alternate mirror to files :http://www.mediafire.com/?8vp99zjfkbe42z2
reserved....
Nice to see you finally got it how you wanted it. Thanks for the guide
Sent from my myTouch_4G_Slide using Tapatalk 2
Nice guide. Thank you.
TEAM MiK
MikROMs Since 3/13/11
strapped365 said:
Nice to see you finally got it how you wanted it. Thanks for the guide
Sent from my myTouch_4G_Slide using Tapatalk 2
Click to expand...
Click to collapse
Yessir, I was giddy like a little school girl when I finally got it to function how I wanted
Sent from my HTC Evo Shift using xda app-developers app
Thanks for the work you put into this and the guide
Never mind, I figured it out!
SaintZ93 said:
Never mind, I figured it out!
Click to expand...
Click to collapse
lol.. I re-downloaded to double check, checked it, then quoted your reply only to see that you figured it out already... If you need anything else let me know
Awesome
Shifted from planet Namek
thanks Bro for the guide
but I'm still confuse with this
Quote :
"To overcome this on ASOP roms I
download and sign system apks with the
platfrom keys from CyanogenMod's
android_build github. "
can you guide that too ?
Thanks in advance
hello BigSplit.....after I followed your tutorial. I get this in apktool
C: \ Documents and Settings \ server \ Desktop \ ICS Apktool> apkto
I: Checking Whether sources has changed ...
I: Smaling ...
I: Checking Whether resources has changed ...
I: Building resources ...
AAPT: warning: string 'dsds_dsds_device_status' has no def
\ Documents and Settings \ server \ Desktop \ ICS Apktool \ Settings
AAPT: warning: string 'dsdsdevice_status' has no default t
ents and Settings \ server \ Desktop \ ICS Apktool \ Settings \ res;
I: Building apk file ...
C: \ Documents and Settings \ server \ Desktop \ ICS Apktool> apkto
I: Checking Whether sources has changed ...
I: Checking Whether resources has changed ...
I: Building apk file ...
C: \ Documents and Settings \ server \ Desktop \ ICS Apktool>
and I try to push my settings and my settings disappeared after reboot. help me to fix this problem .. thks
did u sign the apk like i mentioned in the op?
Adi_ai****eru said:
thanks Bro for the guide
but I'm still confuse with this
Quote :
"To overcome this on ASOP roms I
download and sign system apks with the
platfrom keys from CyanogenMod's
android_build github. "
can you guide that too ?
Thanks in advance
Click to expand...
Click to collapse
Google for a guide about signing apks. Most tutorials will have you sign apks with test keys, I gave you a link in that sentence you quoted directly to the files I said you should use in signing instead.
BigSplit said:
Google for a guide about signing apks. Most tutorials will have you sign apks with test keys, I gave you a link in that sentence you quoted directly to the files I said you should use in signing instead.
Click to expand...
Click to collapse
Adi_ai****eru said:
thanks Bro for the guide
but I'm still confuse with this
Quote :
"To overcome this on ASOP roms I
download and sign system apks with the
platfrom keys from CyanogenMod's
android_build github. "
can you guide that too ?
Thanks in advance
Click to expand...
Click to collapse
Dont worry, I got you
HOW TO SIGN APKS/ZIPS
Note: Java needs to be installed for this to work
1. Download the signapk.zip file from my mediafire
http://www.mediafire.com/#8gjgusqbct8q2
2. Extract it and read the "usage.txt"
3. Download the .pk8 and .pem files that BigSplit linked to and copy those into the extracted "signapk" directory
4. Open a command prompt window in the "signapk" extracted directory (Shift+RightClick > Open command prompt here)
5. Run the command in the "usage.txt", substituting your downloaded ".pem" file and your downloaded ".pk8" file and the Settings.apk file in the appropriate places
Command should look something like this
Code:
java -jar signapk.jar downloaded-certificate-HERE.pem download-key-HERE.pk8 SettingsAppHere.apk Settings-signed.apk
The "settings-signed.apk" part can be changed to anything, thats just the signed output file
"SettingsAppHere.apk" is the Settings app you are modding
Sent from my PG06100
Time to sticky this one
stare into oblivion
Fall into sleep
turkbot said:
Time to sticky this one
stare into oblivion
Fall into sleep
Click to expand...
Click to collapse
I know right.
Awesome find again, BigSplit, must've taken you a lot of digging in forums and background knowledge but I gotta say, the end product is definitely worth it :good:
Sent from my PG06100
CNexus said:
Dont worry, I got you
HOW TO SIGN APKS/ZIPS
Note: Java needs to be installed for this to work
1. Download the signapk.zip file from my mediafire
http://www.mediafire.com/#8gjgusqbct8q2
2. Extract it and read the "usage.txt"
3. Download the .pk8 and .pem files that BigSplit linked to and copy those into the extracted "signapk" directory
4. Open a command prompt window in the "signapk" extracted directory (Shift+RightClick > Open command prompt here)
5. Run the command in the "usage.txt", substituting your downloaded ".pem" file and your downloaded ".pk8" file and the Settings.apk file in the appropriate places
Command should look something like this
Code:
java -jar signapk.jar downloaded-certificate-HERE.pem download-key-HERE.pk8 SettingsAppHere.apk Settings-signed.apk
The "settings-signed.apk" part can be changed to anything, thats just the signed output file
"SettingsAppHere.apk" is the Settings app you are modding
Sent from my PG06100
Click to expand...
Click to collapse
How about ApkMultitools ?
I ussualy use ApkMultitools to decompile/compile/sign.apk
Sent from my GT-I8150 using xda app-developers app
Adi_ai****eru said:
How about ApkMultitools ?
I ussualy use ApkMultitools to decompile/compile/sign.apk
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
I guess thats fine too. I like doing things manually though when I can
BigSplit said:
did u sign the apk like i mentioned in the op?
Click to expand...
Click to collapse
Sir ... Can you make this for me. I always fail at boot time ... my settings are always lost. probably because I could not find - <public type="layout" name="mainsetting" id="0x7f040090" /> in public.xml,
im st23i 4.0.4. thks sir ..
Nathan Ali Ashari said:
Sir ... Can you make this for me. I always fail at boot time ... my settings are always lost. probably because I could not find - <public type="layout" name="mainsetting" id="0x7f040090" /> in public.xml,
im st23i 4.0.4. thks sir ..
Click to expand...
Click to collapse
So you are on a stock firmware? If so, I would guess that the other packages are not signed with the same keys I linked to since its a stock ROM and not asop. The only thing you can do then is to attempt to re-sign every system apk/jar with a new signature(which I've never been successful at doing).
And the mainsetting will only show up in the public xml AFTER you compile it, then decompile it again. The only reason it wouldnt show up is if you are not placing the files i posted in the correct directories or not recompiling/decompiling when I said to.

[OTG][MOD][ICS] Mount Externel USB Storage on Settings [Locked Bootloader]

First of all give thanx to the below post for their awesome work and then download those files.....
to make the kermel compitable for OTG Kernel Modules for Xperia 2011 ICS v4.1.B.0.587
to load the kernel on boot [APP][2.2+] Module Loader 1.1
Now here we go to Mount Externel USB Storage on Settings as in the below pic....
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
if anything goes wrong don't blame me.......
I tested it on my LWW and the above pictures were taken on my phone.....
to do this we need...
1. apktool
2. notepad++
3. framework-res.apk
4. vold.fstab
1st,
open vold.fstab from \system\etc\ by root explorer and add the below line
Code:
dev_mount usbdisk /mnt/usbdisk auto /devices/platform/msm_hsusb_host.0
2nd,
Decompile your framework-res.apk by apktool
open public.xml with notepad++ from \res\values
add this line
Code:
<public type="string" name="storage_usb" id="0x010404cd" />
open strings.xml with notepad++ from \res\values
add this line
Code:
<string name="storage_usb">External USB storage</string>
open storage_list.xml with notepad++ from \res\xml
add red colored line
Code:
<?xml version="1.0" encoding="utf-8"?>
<StorageList
xmlns:android="http://schemas.android.com/apk/res/android">
<storage android:mountPoint="/mnt/sdcard" android:storageDescription="@string/storage_sd_card" android:primary="true" android:removable="true" android:allowMassStorage="true" />
[COLOR="Red"]<storage android:mountPoint="/mnt/usbdisk" android:storageDescription="@string/storage_usb" android:primary="false" android:removable="true" />[/COLOR]
</StorageList>
Recompile framework-res.apk and flash through CWM on your phone.
Click to expand...
Click to collapse
3rd,
we need to create directory for that using notepad++ add these lines
Code:
#Create usbdisk
#!/system/bin/sh
mount -o remount,rw rootfs 2>/dev/null
mkdir /mnt/usbdisk
or download the create usbdisk.zip extract it on your sdcard
Run it through script manager, checking su and boot
Now open your settings go to storage and enjoy...
I have attached some flashable.zip now here you guys can skip 1st & 3rd steps, only need to edit your runing framwork-res.apk
sorry for my bad presentation :crying:
special thanks to
zxp for his Kernel Modules
D4rKn3sSyS for his Module Loader
ICS 4.0.4 Build No. 4.1.B.0.587
Before going to proceed first make backup...
without using any app to get this settings in one step i have made a flashable.zip. but to get this work
you need.....
init.d enabled ( grab this from here ) for loading the kernel module and make the usbdisk directory on boot......
if you have init.d installed, skip this step
it is for Deodex ROM. If your ROM is Odex then flash Deodex587_By PranavPandey.zip via CWM...
If already Deodexed then, skip this step...
flash the Externel_USB_Storage_Settings_by_mOeenuR.zip file through CWM....
wipe dalvic cache.....
reboot...
Click to expand...
Click to collapse
note: if you guys get bootloop then you need to edit your framework-res.apk as i mentioned in the 1st post or restore your backup.
Download Link
Externel_USB_Storage_Settings_by_mOeenuR.zip - 10.94 MB
Special thanks to
puppet13th for his init.d.loader
Pranav Pandey for his ROM Deodexer
F. A. Q. ​
# Why does Storage in settings show force close ?
ans: first open vold.fstab from \system\etc\ by root explorer, check whether the below line is added
Code:
dev_mount usbdisk [B][COLOR="Red"]/mnt/usbdisk[/COLOR][/B] auto /devices/platform/msm_hsusb_host.0
if so then go to the above red marked directory, check usbdisk has created if not created then your init.d is not working if you use my flashable.zip then grab it from my 2nd post.
if still force close then you need to check your framework-res.apk's storage_list.xml
Code:
<storage android:mountPoint="[B][COLOR="red"]/mnt/usbdisk[/COLOR][/B]" android:storageDescription="@string/storage_usb" android:primary="false" android:removable="true" />
# Why does face bootloop?
ans: It will only happen if you flash by wrong framework-res.apk so edit your running framework-res.apk and flash.
# Why OTG is not working?
ans: download Android Terminal Emulator, type lsmod check your kernel module is running if not then use this [APP][2.2+] Module Loader 1.1
if you guys install it on your phone then give a feedback to inform the others whether it works or not for other xperia 2011 devices
very complex process thanks :good:
simple operation :silly: Worked USB OTG helper My LWW mount & unmount USB Disk
https://play.google.com/store/apps/details?id=net.shajul.usbotg&hl=tr
i know that there are many apps to mount usb storage but they dont appear on settings, so i did it. thats all....
i had already posted it here
using apps kernel module can be run from sdcard which save the internel phone memory too...
moeenur said:
ICS 4.0.4 Build No. 4.1.B.0.587
Before going to proceed first make backup...
to get this settings in one step i have made a flashable.zip. but to get this work
you need.....
init.d enabled ( grab this from here ) for loading the kernel module and make the usbdisk directory on boot......
if you have init.d installed, skip this step
it is for Deodex ROM. If your ROM is Odex then flash Deodex587_By PranavPandey.zip via CWM...
If already Deodexed then, skip this step...
note: if you guys get bootloop then you need to edit your framework-res.apk as i mentioned in the 1st post or restore your backup.
Download Link
Externel_USB_Storage_Settings_by_mOeenuR.zip - 10.94 MB
Special thanks to
puppet13th for his init.d.loader
Pranav Pandey for his ROM Deodexer
Click to expand...
Click to collapse
hey buddy
thanks for your GUIDE
i do all the steps properly
but when i tap Storage in my settings it shows force close.
i dont want to use settings.apk you uploaded
please show me how to mod my settings to add usb storage
note : i know how to mod APKs and settings.apk :good:
logcat shows these lines :
13:49:49.490 Error 1956 statfs /mnt/usbdisk failed, errno: 2
13:49:49.602 Warning dalvikvm 1956 threadid=15: thread exiting with uncaught exception (group=0x2b542210)
13:49:49.602 Error AndroidRuntime 1956 FATAL EXCEPTION: MemoryMeasurement
13:49:49.602 Error AndroidRuntime 1956 java.lang.IllegalArgumentException
13:49:49.602 Error AndroidRuntime 1956 at android.os.StatFs.native_setup(Native Method)
13:49:49.602 Error AndroidRuntime 1956 at android.os.StatFs.<init>(StatFs.java:32)
13:49:49.602 Error AndroidRuntime 1956 at com.android.settings.deviceinfo.StorageMeasurement$MeasurementHandler.measureApproximateStorage(StorageMeasurement.java:377)
13:49:49.603 Error AndroidRuntime 1956 at android.os.Handler.dispatchMessage(Handler.java:99)
13:49:49.602 Error AndroidRuntime 1956 at com.android.settings.deviceinfo.StorageMeasurement$MeasurementHandler.handleMessage(StorageMeasurement.java:267)
13:49:49.603 Error AndroidRuntime 1956 at android.os.Looper.loop(Looper.java:137)
13:49:49.603 Error AndroidRuntime 1956 at android.os.HandlerThread.run(HandlerThread.java:60)
13:49:49.603 Warning ActivityManager 1036 Force finishing activity com.android.settings/.SubSettings
13:49:49.603 Warning ActivityManager 1036 Force finishing activity com.android.settings/.Settings
Click to expand...
Click to collapse
don't need to edit settings.apk
Please check whether usbdisk folder has created under mnt folder?
or
dev_mount usbdisk line has been added in vold.fstab?
or
open terminal emulator type lsmod it will show you which kernels are running?
Fc is given ! for one of the above is missing....
moeenur said:
don't need to edit settings.apk
Please check whether usbdisk folder has created under mnt folder?
or
dev_mount usbdisk line has been added in vold.fstab?
or
open terminal emulator type lsmod it will show you which kernels are running?
Fc is given ! for one of the above is missing....
Click to expand...
Click to collapse
there is usbdisk folder in mnt folder
usb modules are live
maybe i had mistake when adding that line to vold.fstab
---------- Post added at 02:11 PM ---------- Previous post was at 02:05 PM ----------
no luck
i check all thing you said
but still force close.
is there any links to kernel?
i using lupusv6
it natively support usb otg
yamin8000 said:
there is usbdisk folder in mnt folder
usb modules are live
maybe i had mistake when adding that line to vold.fstab
---------- Post added at 02:11 PM ---------- Previous post was at 02:05 PM ----------
no luck
i check all thing you said
but still force close.
is there any links to kernel?
i using lupusv6
it natively support usb otg
Click to expand...
Click to collapse
EDIT your framework-res.apk as I mentioned in my 1st post...
keep in mind...
mount point "mnt/usbdisk" of storage.xml and dev_mount "mnt/usbdisk" of vold.fstab should be same..
it will fix your fc...
remove the kernel which i attached with the zip file...

[SOLVED] Installing WebView (rooted Stock ROM)

I am trying to install a clean Android System WebView (packagename: com.android.webview) onto stock LG G5 RS988 RS98821d Android 7.0 that is rooted.
I downloaded an arm64 WebView APK from the Bromite Releases GitHub page:
https://github.com/bromite/bromite/releases
I tried installing the Bromite WebView APK to "/system/app/webview/" (0644 permissions) and rebooted, but the WebView implementation could not be used.
There are instructions regarding installing Bromite System WebView available:
https://github.com/bromite/bromite/wiki/Installing-SystemWebView
From my reading of the installation instructions, "res/xml/config_webview_packages.xml" from "/system/framework/framework-res.apk" must contain the an entry for the package with the particular package name ("com.android.webview" in this case).
After examining the stock "config_webview_packages.xml" member file, it appears that a reference to "com.android.webview" is not present. The "config_webview_packages.xml" XML file also appears to not be easily readable in a text editor. My guess is that it has some kind of signing.
What must be done to get the system to allow the newly installed WebView? My impression is that the "config_webview_packages.xml" XML file must be edited, but it is not clear how to do so, given that it does not appear to be just plain text.
I have attached a copy of the "config_webview_packages.xml" XML member file and the original framework-res.apk file zipped into a ZIP 2.0 archive.
XML files inside apks are compressed, you should unpack the framework-res.apk using a tool for apk editing, not just a zip archiver program. On Android, you can use APK Editor Pro, for example.
By the way, have you already uninstalled Chrome? If Chrome is installed, it will be forced as the standard WebView provider.
tremalnaik said:
XML files inside apks are compressed, you should unpack the framework-res.apk using a tool for apk editing, not just a zip archiver program. On Android, you can use APK Editor Pro, for example.
Click to expand...
Click to collapse
It was my impression that the APK files were zip files with a particular signature block. I shall try a tool like APK Editor Pro and report back.
tremalnaik said:
have you already uninstalled Chrome? If Chrome is installed, it will be forced as the standard WebView provider.
Click to expand...
Click to collapse
I have uninstalled/removed both Chrome and the Android System WebView (Google Apps version).
Ascii3 said:
It was my impression that the APK files were zip files with a particular signature block. I shall try a tool like APK Editor Pro and report back.
Click to expand...
Click to collapse
Now I'm on PC and I remember the name of the tool I use sometimes on PC: APKChanger. It's very complete, although very heavy (about 650MB with my current configuration);
If you have platform tools installed on your pc, or the whole Android Studio, you can also use
Code:
aapt d xmltree framework-res.apk res/xml/config_webview_packages.xml
to see the list of allowed webview packages.
Ascii3 said:
I have uninstalled/removed both Chrome and the Android System WebView (Google Apps version).
Click to expand...
Click to collapse
So we can be sure the problem is not the system forcing Chrome as default WebView provider. So, as Bromite's wiki states, "Changing the package name does not make installation easier/possible;", so the only solution is to add com.android.webview to config_webview_packages.xml, or, if it is already there, remove the requirement for Google's signature on the webview package. EDIT: I checked, on your file com.android.webview is missing, you just need to add it:
Code:
E: webviewproviders (line=20)
E: webviewprovider (line=21)
A: description="Chrome Stable" (Raw: "Chrome Stable")
A: packageName="com.android.chrome" (Raw: "com.android.chrome")
A: availableByDefault=(type 0x12)0xffffffff (Raw: "true")
E: webviewprovider (line=24)
A: description="Google WebView" (Raw: "Google WebView")
A: packageName="com.google.android.webview" (Raw: "com.google.android.webview")
A: availableByDefault=(type 0x12)0xffffffff (Raw: "true")
A: isFallback=(type 0x12)0xffffffff (Raw: "true")
E: webviewprovider (line=27)
A: description="Chrome Beta" (Raw: "Chrome Beta")
A: packageName="com.chrome.beta" (Raw: "com.chrome.beta")
E: signature (line=28)
C: "MIIDwzCCAqugAwIBAgIJAOoj9MXoVhH6MA0GCSqGSIb3DQEBBQUAMHgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEUMBIGA1UEAwwLY2hyb21lX2JldGEwHhcNMTYwMjI5MTUxNTIzWhcNNDMwNzE3MTUxNTIzWjB4MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEUMBIGA1UECgwLR29vZ2xlIEluYy4xEDAOBgNVBAsMB0FuZHJvaWQxFDASBgNVBAMMC2Nocm9tZV9iZXRhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo/wW27nRxVqGbFOyXr8jtv2pc2Ke8XMr6Sfs+3JK2licVaAljGFpLtWH4wUdb50w/QQSPALNLSSyuK/94rtp5Jjs4RSJI+whuewV/R6El+mFXBO3Ek5/op4UrOsR91IM4emvS67Ji2u8gp5EmttVgJtllFZCbtZLPmKuTaOkOB+EdWIxrYiHVEEaAcQpEHa9UgWUZ0bMfPj8j3F0w+Ak2ttmTjoFGLaZjuBAYwfdctN1b0sdLT9Lif45kMCb8QwPp0F9/ozs0rrTc+I6vnTS8kfFQfk7GIE4Hgm+cYQEHkIA6gLJxUVWvPZGdulAZw7wPt/neOkazHNZPcV4pYuNLQIDAQABo1AwTjAdBgNVHQ4EFgQU5t7dhcZfOSixRsiJ1E46JhzPlwowHwYDVR0jBBgwFoAU5t7dhcZfOSixRsiJ1E46JhzPlwowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAZO2jB8P1d8ki3KZILvp27a2VM3DInlp8I8UgG3gh7nBQfTrnZr5M1PL8eFHqX7MEvAiGCMTcrPklEhjtcHK/c7BcdeCWq6oL56UK3JTl33RxJcjmjrz3e3VI6ehRSm1feNAkMD0Nr2RWr2LCYheAEmwTPtluLOJS+i7WhnXJzBtg5UpUFEbdFYenqUbDzya+cUVp0197k7hUTs8/Hxs0wf79o/TZXzTBq9eYQkiITonRN8+5QCBl1XmZKV0IHkzGFES1RP+fTiZpIjZT+W4tasHgs9QTTks4CCpyHBAy+uy7tApe1AxCzihgecCfUN1hWIltKwGZS6EE0bu0OXPzaQ=="
E: webviewprovider (line=30)
A: description="Chrome Dev" (Raw: "Chrome Dev")
A: packageName="com.chrome.dev" (Raw: "com.chrome.dev")
E: signature (line=31)
C: "MIIDwTCCAqmgAwIBAgIJAOSN+O0cdii5MA0GCSqGSIb3DQEBBQUAMHcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDETMBEGA1UEAwwKY2hyb21lX2RldjAeFw0xNjAyMjkxNzUwMDdaFw00MzA3MTcxNzUwMDdaMHcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDETMBEGA1UEAwwKY2hyb21lX2RldjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOYPj6Y9rVt8xizSHDYjDEkDfFZAgSiZ9T6tevkQXsFyfaq3Gk3h2qssi29G6cTPJ2VXFKlVB71wSXv5p9/LEcDQPWQiO3Q2cLmgUXxyhJWXI3g96tPAhZQX2q6SC37ZQdiBR/raMO70DAkvCyBGtNplsvutzSE3oZ7LYfzB8vTbe7zCh3fDYSS/7xb3ZVvFqydHS40uVq1qqg1S80Pge7tW3pDGsPMZN7yA4yfmsvA1rbHm9N8t3Rc9hqzh6OxNAAgRB535YcsWL7iF+mpdFILXk3jLYT0nMvMnB83rsdgnRREjlGQYHl2mh8+6CqujsW/eICDq/LR6BYDyqHhk0ECAwEAAaNQME4wHQYDVR0OBBYEFKzsl07JglgpbeYDYGqsgqRDo+01MB8GA1UdIwQYMBaAFKzsl07JglgpbeYDYGqsgqRDo+01MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBACka6SFF6xAcj8L8O6R36++E09DTiGZEjvKT8eIycgcQQ+p1WUmPb6M2EJpN6zvvSE62ussmXdzf8rIyc0JXA8jbViZt62Y39epNENFxPTLN9QzXlT+w8AW73Ka3cnbOuL5EgoDl8fM79WVlARY3X+wB/jGNrkiGIdRm2IZIeAodWgC2mtXMiferyYBKz2/F2bhnU6DwgCbegS8trFjEWviijWdJ+lBdobn7LRc3orZCtHl8UyvRDi7cye3sK9y3BM39k0g20F21wTNHAonnvL6zbuNgpd+UEsVxDpOeWrEdBFN7Md0CI2wnu8eA8ljJD45v0WWMEoxsIi131g5piNM="
E: webviewprovider (line=33)
A: description="Chrome Canary" (Raw: "Chrome Canary")
A: packageName="com.chrome.canary" (Raw: "com.chrome.canary")
E: signature (line=34)
C: "MIIDxzCCAq+gAwIBAgIJAML7APITsgV7MA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEWMBQGA1UEAwwNY2hyb21lX2NhbmFyeTAeFw0xNjAyMjkxOTA5MDdaFw00MzA3MTcxOTA5MDdaMHoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEWMBQGA1UEAwwNY2hyb21lX2NhbmFyeTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANXfeAoZlr0ya1HBzIfAz/nLLjpPJeAPvuX5dueaxmiQgv2hNG22acriFuiiJI6TU0t8AIVJD5Ifbc4OOuA0zeFhdzWWGnmTRH6x27WI7bzOKnAqOvv21ZBmE9i8Vo++K13xWdTs3qVn1bn9oUONxFu0wKDzXYZhoj1Jom0RZGjXm16xuPlEuOzMcjiNBDoYuxPAXkMcK/G1gP4P4nAV8Rd/GGIjKRS/SUtcShhoAMOQhs4WIEkUrvEVRwhBDIbpM87oFbCVdBH38r0XS6F6CdhPJsKFhoEfq4c01HZqNmDpCPA8AAcCuSWqmXoTIqs7OqkWgduE2bInbWU7WMaTl+kCAwEAAaNQME4wHQYDVR0OBBYEFB/AsC4iPAqaLoNytNSx29qByI7+MB8GA1UdIwQYMBaAFB/AsC4iPAqaLoNytNSx29qByI7+MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAMb2Td3ro/+MGVnCPAbwBSOZMVLUKGqt6zr8CShW9mtFHnmy29EaWSYYAj1M4+6Vpkq85NsgBEck7rnUjV8A3Q0NKdTys1KRKJqVvQRBN6SwqQenSf/abxQCa8Z+69rh+3BkIU1HLtu5lrMDZwon5H91L5mpORn6vItd20uW132lwSDeUEW2CHslTrodoFuTUcSUlRiq/URfUH3baO1QHXkxpQwrBPKL5deJfcZnxh5MAtAGSQL7gHvayEFlDppETXdDO7vgGTH2dEK2TjKWALbGiKkxSqjRyTNt4/FOj10TqNRdUamj+ydVJgzGQ8bki4Vc6NnKm/r4asusxapkVR4="
E: webviewprovider (line=36)
A: description="Chrome Debug" (Raw: "Chrome Debug")
A: packageName="com.google.android.apps.chrome" (Raw: "com.google.android.apps.chrome")
On Android, I used APK Editor Pro 1.10.0 to modify res/xml/config_webview_packages.xml of /system/framework/framework-res.apk. A new APK with a generic signature was generated with the modification. I used the XML file editing option to select and modify the config_webview_packages.xml. The XML file editing functionality is given to be in beta and appears buggy.
I replaced the original /system/framework/framework-res.apk file with the patched one using the TWRP 3.2.3-0 file manager and attempted to boot to system. The system would start, but get stuck at the LG logo screen. I tried wiping data, and cache in recovery and booting again, but received the same result. I note that adb was available and usable after the boot process got stuck on the LG Logo screen.
My impression is that the patched framework-res.apk file is incompatible or defective. Perhaps APK Editor Pro 1.10.0 malformed the output APK (the XML editing feature appeared unfinished) or that the LG stock ROM expects framework-res.apk to have have a particular signature.
Perhaps a different APK editing tool should be tried. What could the problem be?
I have attached a ZIP archive containing the APK Editor Pro 1.10.0 modified framework-res.apk.
EDIT: Attachment has been removed; the file was defective and should not be used. Attachment is no longer necessary.
I have now patched framewor-res.apk successfully, and Bromite System WebView is working.
Did you use again APk Editor Pro or a PC tool?
The tools I used were Windows tools (and with a Java dependency in the case of Apktool) and were: Apktool 2.3.1 and WinRAR 5.6.1. I found that it is best to avoid newer versions of the tool unless trying to manipulate Android 9 Pie or newer resources.
Ascii3 said:
I have now patched framewor-res.apk successfully, and Bromite System WebView is working.
Click to expand...
Click to collapse
I know this is an old post, but how did you get it to boot?
I'm using apktool 2.5 and seems to be stuck on the boot screen as you were
burny02 said:
I know this is an old post, but how did you get it to boot?
I'm using apktool 2.5 and seems to be stuck on the boot screen as you were
Click to expand...
Click to collapse
From somewhere else it seems that you are now using Apktool 2.3.1.
After comparing my notes, my impression on what you are missing and some related notes:
The modified framework-res.apk should use the unmodified APK file's "AndroidManifest.xml" root file and META-INF directory contents. It is not sufficient for any of the content to be the same after decompiling.
Copy "AndroidManifest.xml" and META-INF directory from original framework-res.apk to modified framework-res.apk using zip program, if contents are different.
v2 APK signing scheme (which includes the APK file itself in validation), if present, would be broken, but the scheme's enforcement is not enforced on /system; v1 APK signing scheme (on APK contents ("AndroidManifest.xml" file and META-INF directory contents)) is still enforced.
I zipaligned output/modified framework-res.apk prior to transferring original "AndroidManifest.xml" file and META-INF directory contents, but I do not believe it matters for the purposes of getting a functional framework-res.apk.
EDIT: Some added things to keep in mind:
Sometimes clearing system cache and the runtimes cache is also necessary before system will boot after framework-res.apk replacement. Also make sure that the permissions of the replaced framework-res.apk file are at minimum whatever the original file permissions were. Depending on what software you use to replace the framework-res.apk file, the permissions set may be different.
I really appreciate the help, still does not work unfortunately.
Here is what I do:
adb pull framework-res.apk
apktool d framework-res.apk (tried most versions, mainly now 2.3.1)
Edit framework-res/res/xml/config-webview-packages.xml to:
Code:
<webviewproviders>
<webviewprovider description="Bromite WebView" packageName="com.android.webview" availableByDefault="true" isFallback="true" />
</webviewproviders>
Removing other dev versions with signatures etc
apktool b framework-res
zipalign -v 4 framework-res.apk framework-res-new.apk
Move META-INF and AndroidManifest.xml from the 1st original framework-res.apk > framework-res-new.apk (Have also tried moving res & resources from the new to the original...7Zip, WinRAR, CLI - Linux)
adb push framework-res-new.apk /system/framwork-res.apk
Modify permissions in TWRP > 0644
Move framework-res.apk from /system/ to /system/framework/framwork-res.apk (I read somewhere this is better than pushing directly. Neither worked)
Clear Davlik & Cache
Reboot
Hangs on boot screen
Any ideas if I am missing something important?
@burny02 - Please clarify whether the framework-res.apk you are trying to modify is for LG G5 stock ROM Android Nougat.
I note that you are using the "isFallback="true"" flag with the webviewprovider tag. The purpose of the isFallback attribute set to true (its default is false) is to specify that the WebView provider should be disabled by deault and should only become available when allow other WebView providers are disabled. Using the attribute with the true value with only a single WebView provider seems improper. I do not know if boot should fail if the attribute is present in the way that it is, but in both scenarios I would recommend its omission.
It has also been a while since I used Apktool versions and do not exactly remember the command lines. Do not take my not pointing to an issue with it as there necessarily not being an issue. One thing I would mention is that one typically first install a frameworks before decompiling and building. For the LG G5 RS988 Android Nougat, I believe installing the framework-res.apk as a framework was sufficient. You would specify on command line "apktool if framework-res.apk" and any tags you wish to explicitly specify, if any.
The moving of framework-res.apk to /system/ before /system/framework/ is oftentimes done by people to try to install a modified framework-res.apk with proper permissions and on a live system before the system crashes and reboots. Once framework-res.apk is copied to /system , but does not replace the framework-res.apk file, proper permissions can be set prior to using that file to replace the live framework-res.apk. It is still important to note that some software disregards permissions set when a file is relocated or copied, so this could be an issue if framework-res.apk is replaced with more restrictive permissions than the original framework-res.apk (less restrictive permissions should not usually be a problem for the app to be used). I particularity do not like the idea of the system crashing and prefer to make such changes offline (such as via the aid of a custom recovery).
Sorted. Got it working. Really appreciate the help, Ascii3
For anyone looking at this in the future, the isFallback back seems to stop booting, regardless of whether it is the only entry or not.
The procedure then works as above:
adb pull framework-res.apk
apktool d framework-res.apk (2.3.4 worked for me - SDK 24 Android 7.1 (LGG5))
Edit framework-res/res/xml/config-webview-packages.xml to:
Code:
<webviewproviders>
<webviewprovider description="Bromite WebView" packageName="com.android.webview" availableByDefault="true" />
</webviewproviders>
apktool b framework-res
Move META-INF and AndroidManifest.xml from the 1st original framework-res.apk > new framework-res-new.apk (Used 7Zip drag & drop)
adb push framework-res-new.apk /system/framework/framwork-res.apk
Modify permissions in TWRP > 0644
Clear Davlik & Cache
Reboot
I found the following unnecessary :
Installing framework (apktool if)
Zip-aligning
Moving to /system prior to /system/framework/ (Using TWRP, live system; it might be necessary)
burny02 said:
Sorted. Got it working. Really appreciate the help, Ascii3
Click to expand...
Click to collapse
Sure.
burny02 said:
For anyone looking at this in the future, the isFallback back seems to stop booting, regardless of whether it is the only entry or not.
Click to expand...
Click to collapse
The isFallback attribute is supposed to only be set to true for no more than one webviewprovider. Explicitly setting it to false (its default) should not be problematic (but does result in a larger config-webview-packages.xml file generated). Setting isFallback to true on the only webviewprovider item is not an intended use and apparently results in no boot.
burny02 said:
I found the following unnecessary :
Zip-aligning
Click to expand...
Click to collapse
I do not think zip-aligning apps is necessary generally . My understanding around the reason to do so is to try to optimize the packaged data to be more efficiently fetched in the manner which Android fetches the data.
@Ascii3 @burny02
Hello guys, sorry to exhume this post but I'm struggling and all other threads are maybe ten years old...
So I'm struggling to replicate what you did! I'm no expert but I can follow basic instructions.
So I do as you say, decompile framework-res.apk, modify the xml file (I just add the line). This step seems okay since I did some errors while editing the file and apktool would not recompile properly. Now this goes fine.
Then I got my freshly recompiled framework-res.apk, but 7zip on linux won't let me insert META-INF and AndroidManifest.xml. So I had to rename the extension .zip, do it, then rename in apk. Could this be an issue? It looks dirty.
Anyway, after this you didn't had to resign the apk? I read everywhere you had to, so I did. I did not zipaligned it since I used a resign tool I found on xda and I could not tell if I had to do it before or after resigning, but since you said you didn't zipalign it I thought whatever.
The problem is the following: after replacing framework-res.apk in /system/framework, the phone won't start, I get stuck on the starting screen and I could extract the following from logging:
01-24 04:15:17.470 +0000 4042 4042 I PackageManager: /system/framework/framework-res.apk changed; collecting certs
01-24 04:15:17.749 +0000 4042 4042 W PackageManager: Failed to scan /system/framework/framework-res.apk: Failed to collect certificates from /system/framework/framework-res.apk
Have you got any ideas of what I did wrong? It's my fourth soft-brick today, I'm getting a bit annoyed.
Thanks in advance
@LeSplendide did you ever get this working? Not sure if I'm having the same trouble, but I followed burny's instructions and my phone fails to boot. I checked logcat but I don't see anything relating to framework-res. I'm using magisk to overlay it because if I touch the /system partition for real, VoLTE stops working on my phone (known issue for this phone). I'm successfully overlaying stuff in /system/app and /system/priv-app so I do have overlaying generally working, though this is the first apk in the framework directory I've tried to overlay. Boy do I want to get this working. I've extensively degoogled and debloated this phone and the only glaring thing that remains is chrome handling webview.
TheShanMan said:
@LeSplendide did you ever get this working? Not sure if I'm having the same trouble, but I followed burny's instructions and my phone fails to boot. I checked logcat but I don't see anything relating to framework-res. I'm using magisk to overlay it because if I touch the /system partition for real, VoLTE stops working on my phone (known issue for this phone). I'm successfully overlaying stuff in /system/app and /system/priv-app so I do have overlaying generally working, though this is the first apk in the framework directory I've tried to overlay. Boy do I want to get this working. I've extensively degoogled and debloated this phone and the only glaring thing that remains is chrome handling webview.
Click to expand...
Click to collapse
I'm sorry I have no idea, rn Webview Implementation says I have Android System Webvew 102.0.5005 so I assume this is chrome webview? But I have no clue what I did or not but I know for sure I fixed my problem which was that Webview would crash when trying to sign in a google account on my MicroG'd LEAOS. Now this works so I guess I did make it work. All I found that could be a clue is a update.zip containing instructions and the webview in question. Iirc, the issue was that the zip needed to be signed so that twrp could flash it, so I think I just signed my zip and it worked but can"t tell for sure.

Android 11, Is it possible to use an RRO apk to overlay settings in framework-res.apk?

I've created an overlay apk to overlay a setting in framework-res.apk.
I followed this Guide
Edit: I figured it out. This was on LineageOS 18.1. enable root debugging in developer options. (If you dont see it, It's because you have magisk installed. In the future make sure you enable root debugging before installing magisk. It gets hidden. but just fastboot flash boot original boot img. enable it, then fastboot flash boot magisk patched boot.)
1. Create the RRO
adb root
adb remount
adb push /system/product/overlay/[RRO Name]/[RRO Name.apk]
adb reboot
I didn't have to sign or zipalign the file. You can if you want to, I used platform test keys until I realized it wasn't necessary.
This is how I created the apk.
File: /res/values/integers.xml
XML:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="config_screenBrightnessSettingMinimum">1</integer>
</resources>
File: AndroidManifest.xml
XML:
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="30" android:compileSdkVersionCodename="11" package="com.ben.changeMinBrightness" platformBuildVersionCode="30" platformBuildVersionName="11">
<overlay android:isStatic="true" android:priority="2" android:targetPackage="android"/>
<application android:hasCode="false"/>
</manifest>
Used aapt2:
Code:
aapt2 compile --dir \res\ -o compiled\
aapt2 link -o changeMinBrightness.apk -I framework-res.apk compiled/values_integers.arsc.flat --manifest AndroidManifest.xml
See above
Can you make a RRO overlay to replace chrome webview to on Android webview(google version)
Rakshak53 said:
Can you make a RRO overlay to replace chrome webview to on Android webview(google version)
Click to expand...
Click to collapse
If you are interested, I made one.
arovlad said:
If you are interested, I made one.
Click to expand...
Click to collapse
I'm try your overlay.apk . But this overlay remove com.google.webview from list of webview. now I don't have any webview.
What i want - i want Google webview apk as only webview provider that's it. (And remove Chrome apk from webview provider list)
Rakshak53 said:
I'm try your overlay.apk . But this overlay remove com.google.webview from list of webview. now I don't have any webview.
Click to expand...
Click to collapse
After installing the overlay you must install download Bromite SystemWebView and install it as you would install a regular app.
May I ask why do you need the Google WebView instead of the more secure, privacy-respecting Bromite WebView?
Rakshak53 said:
What i want - i want Google webview apk as only webview provider that's it. (And remove Chrome apk from webview provider list)
Click to expand...
Click to collapse
If you absolutely want the Google WebView you can add the following 3 lines
XML:
<webviewprovider description="Google WebView" packageName="com.google.android.webview" availableByDefault="true" isFallback="true">
<signature>MIIDuzCCAqOgAwIBAgIJANi6DgBQG4ZTMA0GCSqGSIb3DQEBBQUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEQMA4GA1UEAwwHd2VidmlldzAeFw0xNDA4MDgyMzIwMjBaFw00MTEyMjQyMzIwMjBaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEQMA4GA1UEAwwHd2VidmlldzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbtaFX0r5aZJMAbPVMAgK1ZZ29dTn91VsGxXv2hqrQo7IpqEy2JmPvPnoMsSiuTAe+UcQy8oKDQ2aYVSAd1DGIy+nSRyFTt3LSIAdwSBkB1qT4a+OqkpsR6bSNXQXQ18lCQu9gREY3h3QlYBQAyzRxw4hRGlrXAzuSz1Ec4W+6x4nLG5DG61MAMR8ClF9XSqbmGB3kyZ70A0X9OPYYxiMWP1ExaYvpaVqjyZZcrPwr+vtW8oCuGBUtHpBUH3OoG+9s2YMcgLG7vCK9awKDqlPcJSpIAAj6uGs4gORmkqxZRMskLSTWbhP4p+3Ap8jYzTVB6Y1/DMVmYTWRMcPW0macCAwEAAaNQME4wHQYDVR0OBBYEFJ6bAR6/QVm4w9LRSGQiaR5Rhp3TMB8GA1UdIwQYMBaAFJ6bAR6/QVm4w9LRSGQiaR5Rhp3TMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAEQu8QiVxax7/diEiJrgKE1LwdXsIygJK/KnaKdnYEkAQpeu/QmrLiycm+OFbL1qHJIB7OuI/PQBUtcaNSiJSCVgtwtEbZWWIdsynqG/Nf4aGOndXegSQNRH54M05sRHLoeRycPrY7xQlEwGikNFR76+5UdwFBQI3Gn22g6puJnVukQm/wXQ+ajoiS4QclrNlixoDQsZ4STLH4+Wju2wIWKFFArIhVEIlbamq+p6BghuzH3aIz/Fy0YTQKi7SA+0fuNeCaqlSm5pYSt6p5CH89y1Fr+wFc5r3iLRnUwRcy08ESC7bZJnxV3d/YQ5valTxBbzku/dQbXVj/xg69H8l8M=</signature>
</webviewprovider>
in this file and then build it yourself. You just need to run a script and that's it.

Categories

Resources