microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
7.69k stars 1.62k forks source link

Share Button In Gallery Apps Or Apps That Have "Share" Not Working In microG #713

Open 0pLuS0 opened 5 years ago

0pLuS0 commented 5 years ago

I've recently run into a serious problem trying to covert a Google ROM using SuperR's Kitchen and removing all the Google that you would normally do debloating.

I've now noticed that the Share Button does not work in any Gallery Application, or applications that have the Share feature for them.

This is a really serious problem having such a feature not working, and I'd love to be able to take a Google ROM and convert it in SuperR's Kitchen, as I am doing and have this work.

I've attached a logcat, hopefully it will show something, as to why this Share Feature is not working.

I tried like 6-7 Gallery apps, and none of them worked.

If I install the Google ROM, debloat it, then install microG, this works, but I don't want to do this. I want to build the Google ROM in SuperR's Kitchen and hopefully make this work.

I'm doing this in OxygenOS 5.1.7 for a OnePlus 5T and these are the apps I've removed from the ROM and replaced with microG;

system/app/Account system/app/BTtestmode system/app/CalendarGoogle system/app/Chrome system/app/Drive system/app/Duo system/app/EasterEgg system/app/EngineeringMode system/app/EngSpecialTest system/app/Gmail2 system/app/GoogleContactsSyncAdapter system/app/GooglePay system/app/GooglePrintRecommendationService system/app/LatinImeGoogle system/app/LogKitSdService system/app/Maps system/app/Music2 system/app/NFCTestMode system/app/NVBackupUI system/app/OemAutoTestServer system/app/OEMLogKit system/app/OPBackup system/app/OPBugReportLite system/app/OpenWnn system/app/OPPush system/app/OPSocialNetworkHub system/app/OPWidget system/app/Photos system/app/PhotosOnline system/app/RfToolkit system/app/uimremoteclient system/app/Videos system/app/WebViewGoogle system/app/YouTube system/bin/bugreport system/bin/fmfactorytest system/bin/oemlogkit system/etc/usb_drivers.iso system/priv-app/com.qualcomm.location system/priv-app/GoogleFeedback system/priv-app/GooglePartnerSetup system/priv-app/GoogleServicesFramework system/priv-app/OnePlusWizard system/priv-app/OPDeviceManager system/priv-app/OPDeviceManagerProvider system/priv-app/Phonesky system/priv-app/Velvet system/reserve/OPForum system/reserve/Weather

I also disabled the Setup Wizard in the build.prop;

ro.setupwizard.mode=DISABLED

Now building the ROM in SuperR's Kitchen, and flashing it in TWRP, this function does not work.

logcat.txt

0pLuS0 commented 5 years ago

@Nanolx I know you work on the NanoDroid project, and I hope by mentioning you in this issue you will see this and maybe you can help, since you work on NanoDroid-microG, which by the way is the version I am using in this ROM.

I really need to figure out if this is possible to work, otherwise this is just a mess/problem to have in a ROM, with no Gallery application working properly with the Share Feature...

@ale5000-git, I also hope by mentioning you, you will see this issue if you are around.

Maybe you have a solution for this, but your microG installer is not going to work either. microG as I've mentioned doesn't stand on it's own in this situation with a Google ROM, Google ROMs have to be debloated, then microG installed for this to work.

Oh what a mess this is.... I've been playing around with this for weeks, with no solution I can see... :(

0pLuS0 commented 5 years ago

@mar-v-in any help would be appreciated if what I am doing converting a Google ROM to a microG should be able to work?

For the moment, this does not seem possible....

Thanks

Nanolx commented 5 years ago

All I can say is, that this is not true per sé.

All my apps with a share button have it normally working, but except a few Nintendo apps/games I'm not using any proprietary apps.

My guess is that OxygenOS provides it's own 'share' function that superseds the AOSP one, thus it's not working. You've debloated many stock apps, what happens if you build a ROM with them (only GApps removed)?

A log when opening one of the affected apps might be useful, if it's missing an API or whatever it would complain on start.

0pLuS0 commented 5 years ago

@Nanolx hi, thanks for the reply...

But the big question is, did you Install and run a Google ROM, then debloat it and install microG? I'm not doing this...

As I mentioned I'm converting a Google ROM into a microG ROM, building it in SuperR's Kitchen and this doesn't work.

From what I can tell, OxygenOS needs GSF/Play Services first running, then the ROM debloated and microG installed and it works, because I've done this and it's working...

I provided a logcat when I was trying to make this work in OnePlus Gallery, and about the missing API, etc., no app was complaining when I started them...

Maybe you can look at the logcat to see if it shows you anything?

I'm dying to figure this out if possible and get it working, it's been killing me for the past few months, I've not been able to figure it out, I just get the feeling that with some of the devices support and apps on Google ROMs, these Google ROMs have to run first, then debloat them and then install microG, then it works...

Any help would be greatly appreciated. :)

By the way I went back and flashed OxygenOS 5.1.7 and took several pictures and tapped the Share button in the camera and gallery several times and took a logcat. So between the logcat I posted above and this logcat, hopefully they will show you something...

logcat.txt

Thanks

P.S. I've put everything back into the ROM except GSF and Play Services and this doesn't work. It seems really clear to me that microG is not a full replacement for GSF/Services when trying to convert a Google ROM...

Nanolx commented 5 years ago

Well it does complain about a missing permission (android.permission.READ_EXTERNAL_STORAGE) in oneplus.base.BaseThread thread:

03-03 11:08:45.444  3508  3532 E DatabaseUtils: Writing exception to parcel
03-03 11:08:45.444  3508  3532 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/43 from pid=5172, uid=10034 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
03-03 11:08:45.444  3508  3532 E DatabaseUtils:     at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:699)
03-03 11:08:45.444  3508  3532 E DatabaseUtils:     at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:560)
03-03 11:08:45.444  3508  3532 E DatabaseUtils:     at android.content.ContentProvider$Transport.query(ContentProvider.java:219)
03-03 11:08:45.444  3508  3532 E DatabaseUtils:     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
03-03 11:08:45.444  3508  3532 E DatabaseUtils:     at android.os.Binder.execTransact(Binder.java:714)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource: queryMediaStoreContent() - Fail to query from media store, media ID : 43
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/43 from pid=5172, uid=10034 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.os.Parcel.readException(Parcel.java:2005)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.content.ContentProviderProxy.query(ContentProviderNative.java:432)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.content.ContentProviderClient.query(ContentProviderClient.java:154)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.content.ContentProviderClient.query(ContentProviderClient.java:137)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.content.ContentProviderClient.query(ContentProviderClient.java:127)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at com.oneplus.gallery2.media.MediaStoreMediaSource.queryMediaStoreContent(MediaStoreMediaSource.java:2317)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at com.oneplus.gallery2.media.MediaStoreMediaSource.access$3200(MediaStoreMediaSource.java:90)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at com.oneplus.gallery2.media.MediaStoreMediaSource$22.run(MediaStoreMediaSource.java:2603)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.os.Handler.handleCallback(Handler.java:790)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at android.os.Looper.loop(Looper.java:164)
03-03 11:08:45.444  5172  5187 E MediaStoreMediaSource:     at com.oneplus.base.BaseThread.run(BaseThread.java:393)
03-03 11:08:45.446  5172  5172 D TempMediaSource: getMedia() - mimeType : image/jpeg , uriString : content://media/external/file/43
03-03 11:08:45.448  3508  3532 E ContentProviderNative: onTransact error from {P:5172;U:10034}
03-03 11:08:45.448  3508  3532 E DatabaseUtils: Writing exception to parcel
03-03 11:08:45.448  3508  3532 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/43 from pid=5172, uid=10034 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
03-03 11:08:45.448  3508  3532 E DatabaseUtils:     at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:699)
03-03 11:08:45.448  3508  3532 E DatabaseUtils:     at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:560)
03-03 11:08:45.448  3508  3532 E DatabaseUtils:     at android.content.ContentProvider$Transport.query(ContentProvider.java:219)
03-03 11:08:45.448  3508  3532 E DatabaseUtils:     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
03-03 11:08:45.448  3508  3532 E DatabaseUtils:     at android.os.Binder.execTransact(Binder.java:714)
03-03 11:08:45.448  5172  5187 E TempMediaSource: getMedia() - Failed to query file path.
03-03 11:08:45.448  5172  5187 E TempMediaSource: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file/43 from pid=5172, uid=10034 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.os.Parcel.readException(Parcel.java:2005)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.content.ContentProviderProxy.query(ContentProviderNative.java:432)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.content.ContentResolver.query(ContentResolver.java:793)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.content.ContentResolver.query(ContentResolver.java:712)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.content.ContentResolver.query(ContentResolver.java:670)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at com.oneplus.gallery2.media.TempMediaSource$1.run(TempMediaSource.java:89)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.os.Handler.handleCallback(Handler.java:790)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at android.os.Looper.loop(Looper.java:164)
03-03 11:08:45.448  5172  5187 E TempMediaSource:   at com.oneplus.base.BaseThread.run(BaseThread.java:393)

and a few more.

0pLuS0 commented 5 years ago

@Nanolx thanks for the reply, really appreciate the effort, I thought about permissions recently and tried some, maybe my approach was wrong...

I added this to privapp-permissions-google.xml

< privapp-permissions package="com.google.android.gms" > < permission name="android.permission.READ_EXTERNAL_STORAGE"/ >

I also added it to the framework-res.apk AndroidManifest.xml

< permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:protectionLevel="privileged|signature"/ >

Neither one worked... hmm

If this is the problem, I'm not sure where I should add it?

Thanks

0pLuS0 commented 5 years ago

@Nanolx

I found the bloody problem!

If I just simply resign the framework-res.apk the Share button doesn't work!

In the services.jar I changed it so that Oreo Signature Check is disabled, and I thought with this I could also resign the framework-res.apk and it would work?

This is what was changed in the PackageManagerService.smali;

Services.jar\smali\com\android\server\pm\PackageManagerService.smali

    .locals 7

    const/4 v0, 0x0

    return v0
.end method

So maybe the signature check is working, because if I resign the framework-res.apk the phone will boot up and run, otherwise I'd assume it wouldn't.

So I don't get why just resigning the framework-res.apk causes the Gallery Share feature not to work?

One thing also I noticed, when I tap on the Share button, in the upper left of the Status Bar, the Location icon appears.... hmm

OH now to figure out how I can use my edited and signed framework-res.apk

I also left the original signature on the framework-res.apk after I edited it, but it wouldn't boot...