Code Monkey home page Code Monkey logo

Comments (30)

mcastillof avatar mcastillof commented on September 3, 2024 1

I couldn't reproduce the problem with the old code.

And new problem arises in FakeTraveler when using Android 13,

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: cl.coders.faketraveler, PID: 11990
    java.lang.IllegalArgumentException: cl.coders.faketraveler: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
    Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
        at android.app.PendingIntent.checkFlags(PendingIntent.java:401)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:671)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:658)
        at cl.coders.faketraveler.MainActivity.setAlarm(MainActivity.java:318)
        at cl.coders.faketraveler.MainActivity.applyLocation(MainActivity.java:270)
        at cl.coders.faketraveler.MainActivity$1.onClick(MainActivity.java:81)
        at android.view.View.performClick(View.java:7506)
        at android.view.View.performClickInternal(View.java:7483)
        at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
        at android.view.View$PerformClick.run(View.java:29334)
        at android.os.Handler.handleCallback(Handler.java:942)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7872)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
D/EGL_emulation: app_time_stats: avg=75.43ms min=4.31ms max=727.74ms count=13
I/Process: Sending signal. PID: 11990 SIG: 9

which is solved by changing this line to

    pendingIntent = PendingIntent.getBroadcast(context, SCHEDULE_REQUEST_CODE, serviceIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);

I believe that your code already address this FLAG_IMMUTABLE or FLAG_MUTABLE exception.

So, we are the begging again. We need a tester which had the problem.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024 1

Yeah.. there was an issue about that (missing PendingIntent flag) error in one of my apps a few months ago.. and I pushed an update across all of them at the same time. Easy enough to fix.. just annoying how every new version of Android breaks user space and requires updates to keep existing functionality working.. big pet peeve.

I think the same.

Anyway, as you said.. shame that the emulator wasn't any help. But, huge thanks for bothering to test it! Would've been really nice to run this error through the debugger and be able to determine whether this workaround is actually fixing initialization of the provider.. or simply catching the exception and allowing the app to ignore that it failed.

We had to give it a try to the emulator.

Have a good day/night @warren-bank warren-bank :)

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024 1

Sorry I haven't had the time to take care of FakeTraveler. I will work on the project this days to be sure it works on f-droid..

from faketraveler.

steel-steven-87 avatar steel-steven-87 commented on September 3, 2024

Can confirm this stopped working for me after upgrading to Android 13.

from faketraveler.

Idcrafter avatar Idcrafter commented on September 3, 2024

I can't even start it on my redmi note 10 with custom lineage os but it runs on my pixel 6 pro that runs on calyx os, both android phone versions are Android 13

from faketraveler.

schklom avatar schklom commented on September 3, 2024

FYI, a similar issue got fixed at warren-bank/Android-Mock-Location#14 for my Pixel 6a with GrapheneOS.
The code workaround is dumb, but it works for me.
Maybe it works here too?

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

Hi, all. To quickly summarize the "dumb" workaround (as it's now affectionately known) mentioned by @schklom ...

  • this line of code can.. on some devices (ie: Pixel 6+).. throw an IllegalStateException
  • our fairly "dumb" workaround is to catch this exception and try again.. for example

Also, I should probably mention..
with regard to the question of why an IllegalStateException is being thrown..
Daniel Micay, the founder and lead developer of GrapheneOS, offered a bit of a warning..
though not an explanation, he did say that he doesn't believe this is limited to the Pixel..
that there's nothing special about its hardware to cause this..
but rather, that it happens to be one of only a few devices that runs bleeding-edge AOSP code..
and in time, once device makers catch up, and update the version of Android 13 that's running on their products..
this issue will (most likely) be far more common.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

@TimoGoetze I have made the change that @warren-bank is proposing. Can you test if this APK is working for you?

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

@mcastillof I'd offer to test your build myself, but I'm in the same boat. I don't have a device new enough to reproduce or test this bug. Consequently, I'm also not sure what the effect of this workaround actually is. It's either:

  1. try once.. fail. try again.. succeed
  2. foreach of N retry attempts: try.. fail. silently ignore particular location provider.

I suppose that either option is better than a fatal error.. crash.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

@warren-bank I wonder if a Pixel 6 device with Android 13 (arm64-v8a or x86) emulated using Android Studio could be useful to test the behavior.

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

I don't know.
Also, and this is just a personal quirk.. with a dash of laziness sprinkled on top, but I only test on a few real devices.
That said, the issue didn't occur when tested on a Galaxy S5 w/ LineageOS 20 (Android 13.0).

I was actually wondering whether android-x86 had a nighly release to test in VirtualBox, but the project hasn't been active in quite a long time.

Bliss OS is also some variation of Android x86, but its releases are based on versions of AOSP that are nowhere near new enough.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

I went ahead and tried a Pixel 6 pro with Android 13 (arm64-v8a) in Android Emulator within Android Studio. My host machine has an x86_64 architecture.

./emulator @Pixel_6_Pro_API_33
INFO    | Android emulator version 32.1.12.0 (build_id 9751036) (CL:N/A)
INFO    | Found systemPath /home/user/workspace/android/Android/Sdk/system-images/android-33/google_apis/arm64-v8a/
PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.

I will try an x86_64 image now. Hope it works this time.

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

Yeah, definitely let me know the outcome. The x86_64 image will run.. dunno whether the bug will occur. Curious to find out.

I'm actually reading this.. and am tempted to try the same methodology to run the newest Pixel factory image.. which we know is problematic. Though, now that you mention it, the OP might have been unable to run his image because he was also using an arm64 image.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

Now I'm a bit confused. I only use LineageOS, and I'm not used to that Android/Pixel stuff. The images found in Pixel factory image aren't the same as the images that can be downloaded with in Android Emulator in Android Studio?

Pixel phones come with a different Android version? What's the name of the ROM?

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

since I don't use it.. I'm not an expert.. but my understanding of the emulator that comes with Android Studio is that is uses the qemu emulator and the AVD (android virtual device) images that it downloads directly from google are very much like a factory image.. in that it's a zip file containing individual images for each partition.

as to which version.. or how old the images are.. I'm not sure.. does the AVD manager provide details about each image? ..it's not in front of me at the moment.

for example, this is a link to an old image

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

It booted now (x86_64 image)

image

AVD manager only seems to say that it is an API 33:

Properties
avd.ini.displayname              Pixel 6 Pro API 33 2
avd.ini.encoding                 UTF-8
AvdId                            Pixel_6_Pro_API_33_2
disk.dataPartition.size          2G
fastboot.chosenSnapshotFile
fastboot.forceChosenSnapshotBoot no
fastboot.forceColdBoot           no
fastboot.forceFastBoot           yes
hw.accelerometer                 yes
hw.arc                           false
hw.audioInput                    yes
hw.battery                       yes
hw.camera.back                   virtualscene
hw.camera.front                  emulated
hw.cpu.ncore                     2
hw.device.hash2                  MD5:a8abfd3536f3d35e4ba2041a7b99f40e
hw.device.manufacturer           Google
hw.device.name                   pixel_6_pro
hw.dPad                          no
hw.gps                           yes
hw.gpu.enabled                   yes
hw.gpu.mode                      auto
hw.initialOrientation            Portrait
hw.keyboard                      yes
hw.lcd.density                   560
hw.lcd.height                    3120
hw.lcd.width                     1440
hw.mainKeys                      no
hw.ramSize                       1536
hw.sdCard                        yes
hw.sensors.orientation           yes
hw.sensors.proximity             yes
hw.trackBall                     no
image.androidVersion.api         33
image.sysdir.1                   system-images/android-33/google_apis/x86_64/
PlayStore.enabled                false
runtime.network.latency          none
runtime.network.speed            full
showDeviceFrame                  yes
skin.dynamic                     yes
tag.display                      Google APIs
tag.id                           google_apis
vm.heapSize                      384

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

In the followin image, I downloaded Tiramisu (number 1 red), It showed me the url of the download, but I can't get access to it now,
If I try to download the number 2 red, it show this link
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-UpsideDownCake_r03.zip

image

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

hmm.. I googled the build number.. but it didn't pull anything up.

going by the date of the last security update.. it should be pretty recent.

what happens when you run the last stable release of your app (that users are seeing this issue)?

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

Your fix seems to work fine, as I don't see that it crashes. I will try now without your fix.

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

the response for the URL of that system image includes the header:

last-modified: Wed, 12 Apr 2023 16:15:00 GMT

..but that can't be right

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

pins and needles.. 😃

Pay for the whole seat, but you'll only need.. the edge!

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

Yeah.. there was an issue about that (missing PendingIntent flag) error in one of my apps a few months ago.. and I pushed an update across all of them at the same time. Easy enough to fix.. just annoying how every new version of Android breaks user space and requires updates to keep existing functionality working.. big pet peeve.

Anyway, as you said.. shame that the emulator wasn't any help. But, huge thanks for bothering to test it! Would've been really nice to run this error through the debugger and be able to determine whether this workaround is actually fixing initialization of the provider.. or simply catching the exception and allowing the app to ignore that it failed.

update: I just learned something new.. about the push toward running generic system images. I don't think I have a phone that supports this.. and even if I did, it still looks too risky to try installing an update manually.. but it's great to see.. because it's so very much needed.. and clearly the future for Android updatability. Links: 1, 2, 3, 4, and 5. Related links: 1, 2, and 3.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

If somebody is still having this issue with FakeTraveler v1.9.1, which was released a few days ago in F-Droid, then please try if this APK is working for you and report it here.

from faketraveler.

TimoGoetze avatar TimoGoetze commented on September 3, 2024

Tried the one from F-Droid. First just did not work. Then Crashed again. I cannot try from coders.cl.

``
type: crash
osVersion: google/oriole/oriole:13/TQ2A.230405.003.E1/2023041100:user/release-keys
package: cl.coders.faketraveler:9
process: cl.coders.faketraveler
processUptime: 4501 + 192 ms

java.lang.IllegalStateException
at android.os.Parcel.createExceptionOrNull(Parcel.java:3029)
at android.os.Parcel.createException(Parcel.java:3005)
at android.os.Parcel.readException(Parcel.java:2981)
at android.os.Parcel.readException(Parcel.java:2923)
at android.location.ILocationManager$Stub$Proxy.addTestProvider(ILocationManager.java:2169)
at android.location.LocationManager.addTestProvider(LocationManager.java:2131)
at android.location.LocationManager.addTestProvider(LocationManager.java:2106)
at android.location.LocationManager.addTestProvider(LocationManager.java:2080)
at cl.coders.faketraveler.MockLocationProvider.(MockLocationProvider.java:28)
at cl.coders.faketraveler.MainActivity.applyLocation(MainActivity.java:257)
at cl.coders.faketraveler.MainActivity$1.onClick(MainActivity.java:81)
at android.view.View.performClick(View.java:7506)
at android.view.View.performClickInternal(View.java:7483)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:29357)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7891)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ExecInit.main(ExecInit.java:49)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.internal.util.Preconditions.checkState(Preconditions.java:215)
at com.android.internal.util.Preconditions.checkState(Preconditions.java:200)
at com.android.server.location.LocationManagerService.addLocationProviderManager(LocationManagerService.java:350)
at com.android.server.location.LocationManagerService.getOrAddLocationProviderManager(LocationManagerService.java:342)
at com.android.server.location.LocationManagerService.addTestProvider(LocationManagerService.java:1319)

from faketraveler.

TimoGoetze avatar TimoGoetze commented on September 3, 2024

pixel 6. latest updates.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

Hello @TimoGoetze

Tried the one from F-Droid. First just did not work. Then Crashed again. I cannot try from coders.cl.

Did you experienced any problem with the download of the APK from c.coders.cl server?

I test the download and it worked without any problem. if you prefer I can upload the test APK here in Github.

from faketraveler.

mcastillof avatar mcastillof commented on September 3, 2024

@TimoGoetze I have pushed this beta release to F-Droid. It should be available soon in F-Droid's app. As this is a beta release, you will have to manually install it from the versions dropdown.

If you don't want to wait, you can download an unsigned apk built automatically by GitLab CI at the bottom of the Merge Request.

Please, test the app and come back with feedback.

from faketraveler.

UnlimitedCookies avatar UnlimitedCookies commented on September 3, 2024

@mcastillof It seems the build failed at F-Droid.
Does this version also fix the missing FLAG_IMMUTABLE vor FLAG_MUTABLE for the PendingIntent ? (https://paste.crdroid.net/V6KHeN)

from faketraveler.

warren-bank avatar warren-bank commented on September 3, 2024

@UnlimitedCookies
the FLAG_IMMUTABLE flag is included in master and the most recent tag: v1.9.2-beta,
but not in the most recent stable release: v1.9.1

@mcastillof
fwiw, although it probably isn't necessary, I like to make the inclusion of this flag conditional.. for example:

serviceIntent = new Intent(context, ApplyMockBroadcastReceiver.class);

int flags = PendingIntent.FLAG_CANCEL_CURRENT;
if (Build.VERSION.SDK_INT >= 23)
  flags |= PendingIntent.FLAG_IMMUTABLE;

pendingIntent = PendingIntent.getBroadcast(context, SCHEDULE_REQUEST_CODE, serviceIntent, flags);

from faketraveler.

mnalis avatar mnalis commented on September 3, 2024

@TimoGoetze I have pushed this beta release to F-Droid. It should be available soon in F-Droid's app. As this is a beta release, you will have to manually install it from the versions dropdown.

As noted, unfortunately F-droid build of v1.9.2-beta seemed to fail, and thus it is not available at f-droid at all.

If you don't want to wait, you can download an unsigned apk built automatically by GitLab CI at the bottom of the Merge Request.

Unfortunately, that .apk no longer seem available. I guess it is only kept for some short period of time.
Also, I was hoping to find pre-release APK on this Github repo, but no such luck.

I've ended up forking and having GitHub compile it for me. It wasn't easy as usual, though, as Android CI GitHub workflow was failing. I've managed to make it work (by updating workflow, using not-recommended workaround of setting targetSdkVersion back to 30 and disabling lint.)

Luckily, the resulting .apk worked! (although, for Google Play release, the real culprit of that compilation error should be found and fixed).

Please, test the app and come back with feedback.

I've tested the latest master 1878d70 on Android 13 (Samsung Galaxy S23+) and it no longer crashes there and works just fine! (if others want to try too, the .apk built by GitHub) should be available for next 90 days.

Can we have an release of 1.9.2 please, so regular f-droid.org users can benefit too?

from faketraveler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.