SipManager cannot create SipService. Cannot Bind Context.SIP_SERVICE in Nougat - android

I have an application that uses SipManager to open a SIP profile. I have no difficulties opening the SIP profile on my older(KitKat) device, but my new(Nougat) device throws the a SipException "SipService is dead and is restarting..."
Stepping through the SipManager reveals that 'createSipService' is not binding 'Context.SIP_SERVICE'.
I found this post, which seems to be the same issue.
Does anyone know what changed between KitKat and Nougat that would cause such an error, and what I can do to resolve it?
UPDATE
This is the Exception I get when trying to run mySipManager.open(mSipProfile, pendingIntent, null);
`
W/System.err: android.net.sip.SipException: SipService is dead and is restarting...
W/System.err: at android.net.sip.SipManager.checkSipServiceConnection(SipManager.java:183)
at android.net.sip.SipManager.open(SipManager.java:244)
W/System.err: at com.example.angrinord.myApplication.MyApplication.refreshSipManager(MyApplication.java:59)
at com.example.angrinord.myApplication.MyApplication.onCreate(MyApplication.java:41)
W/System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6017)
W/System.err: at android.app.ActivityThread.-wrap3(ActivityThread.java)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1727)
at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6823)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1557)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445
)`
This happens on running .open() and .close().
UPDATE 2
I just bought a Pixel 3 (Android 9) and it does not have the issue. I can't speak for 5,6, or 8, but this maybe a bug with 7, as both 4 and 9 do not have the issue.

Is Wifi Calling enabled (or can be enabled) on your device?
I have the same issue with an Asus (model X00PD), android is 8.0.
SipManager.IsApiSupported() and SipManager.IsVoipSupported() both return true, however, if I view services under Developer options, Wifi Calling is not running, and the Asus ui disables the option to enable it.
To contrast the Wifi-Calling service is running on my S8 (also 8.0), by default. Same with an older S6(7.0) and a Nokia 6.1(8.1).

Related

React Native for Android 11 get phone number from device using READ_PHONE_NUMBERS

anyone has any idea about Android 11 updates? My APP gets user phone number on SIM and I am using READ_PHONE_STATE permission to get this, but recently Google forced to target SDK above 30(Android11) and from the devices with Android 11, my APP crashes, so I checked document from Google (https://developer.android.com/about/versions/11/privacy/permissions#phone-numbers) and added manifest and updated other stuff as well. Now my APP ask for permission to get phone number on Android 11, no more crash, but it returns null, cannot get phone number. so the question is, any way to solve this issue? or React Native doesn't support get phone number on Android 11? Here are the logs
2021-08-05 15:57:16.427 29800-30293/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.shuket.worldmart.bakchon, PID: 29800
java.lang.SecurityException: getLine1NumberForDisplay: Neither user 11034 nor current process has android.permission.READ_PHONE_STATE, android.permission.READ_SMS, or android.permission.READ_PHONE_NUMBERS
at android.os.Parcel.createExceptionOrNull(Parcel.java:2385)
at android.os.Parcel.createException(Parcel.java:2369)
at android.os.Parcel.readException(Parcel.java:2352)
at android.os.Parcel.readException(Parcel.java:2294)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getLine1NumberForDisplay(ITelephony.java:10831)
at android.telephony.TelephonyManager.getLine1Number(TelephonyManager.java:5349)
at android.telephony.TelephonyManager.getLine1Number(TelephonyManager.java:5317)
at com.learnium.RNDeviceInfo.RNDeviceModule.getPhoneNumberSync(Unknown Source:66)
at com.learnium.RNDeviceInfo.RNDeviceModule.getPhoneNumber(Unknown Source:0)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:147)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:246)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
at java.lang.Thread.run(Thread.java:923)

Fingerprint crash on specific Samsung devices

I've recently released a new app which contains support for authentication via fingerprint.
This has worked fine on all of our test devices:
- OnePlus Three
- OnePlus Five
- Samsung S6 Edge
- Samsung S7
- Samsung S8
But when released, we began getting crashes from Fabric with this stack trace:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.our.app/com.our.app.ui.LoginActivity}: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=30208, uid=10038 requires android.permission.INTERACT_ACROSS_USERS
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=30208, uid=10038 requires android.permission.INTERACT_ACROSS_USERS
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.hasEnrolledFingerprints(IFingerprintService.java:503)
at android.hardware.fingerprint.FingerprintManager.hasEnrolledFingerprints(FingerprintManager.java:776)
at com.our.app.fingerprint.handler.FingerprintHandler.canUseFingerprint(SourceFile:65)
at com.our.app.Client.canUseFingerprint(SourceFile:335)
at com.our.app.ui.LoginActivity.updateViewVisibilityBasedOnState(SourceFile:501)
at com.our.app.ui.LoginActivity.updateViewVisibilityBasedOnState(SourceFile:472)
at com.our.app.ui.LoginActivity.continueWithOnCreateLogic(SourceFile:399)
at com.our.app.ui.LoginActivity.onCreate(SourceFile:321)
at android.app.Activity.performCreate(Activity.java:6904)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
According to Fabric, these devices are experiencing the crash:
- Galaxy A5
- Galaxy S5 Mini
- Galaxy A3(2016)
All of them are running Android 6.0.1.
Seeing as they're all Samsung devices, I began suspecting that Knox could be the issue, even though it isn't specifically listed anywhere in the stacktrace. But i have no idea on how to work around it, or fix it.
I found a similar issue posted on Samsung's own website, but without a fix:
https://seap.samsung.com/forum-topic/getting-javalangsecurityexception-permission-denial
The permission that's named in the stacktrace is a system permission, which no user apps can get. Only system apps can.
Does anyone have an idea on how to fix this?
Not sure if you were ever able to find a solution for this, as a workaround I simply wrapped our calls in a permission check.
inline val Activity.fingerprintManager: FingerprintManagerCompat?
get() = (
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.USE_FINGERPRINT) == PackageManager.PERMISSION_GRANTED) {
FingerprintManagerCompat.from(this)
} else { null }
)
Yes, I’ve seen this crash.
Since INTERACT_WITH_USERS is a system permission, it’s no wonder it crashes for us.
Silly Samsung.
Wrap the code in a try/catch for a SecurityException.
-Ken

Android app crash with ResourceNotFoundException

I recently checked for my GP crash logs and I am getting this callstack very frequently. Could you please help me.
A few things:
The failed to add asset path sometimes shows /data/app/com.xxx.xxx.xxx-x/base.apk and sometimes /mnt/asec/com.xxx.xxx.xxx-x/base.apk.
The device android versions (where it is reported) varies from Android 4.4. to Android 7.0
In the GP console, Android version shows Android 7.0 for all crashes but the device list has devices with Android version 6.0, 5.0, etc which is unclear.
I have two apps with shared user Id, say with package names P1, P2. For P1, the failed to add asset path sometimes shows /data/app/P2 and sometimes /mnt/asec/P1. Isn't this incorrect and what could cause this?
Call stacks:
java.lang.RuntimeException: Unable to create BackupAgent android.app.backup.FullBackupAgent: android.content.res.Resources$NotFoundException: failed to add asset path data/app/com.P2.xxx/base.apk
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:3452)
at android.app.ActivityThread.-wrap5(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1796)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: android.content.res.Resources$NotFoundException: failed to add asset path /data/app/com.P2.xxx/base.apk
at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:281)
at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:359)
at android.app.ResourcesManager.getOrCreateResources(ResourcesManager.java:638)
at android.app.ResourcesManager.getResources(ResourcesManager.java:730)
at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2068)
at android.app.LoadedApk.getResources(LoadedApk.java:780)
at android.app.ContextImpl.<init>(ContextImpl.java:2244)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2184)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2175)
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:3422)
Another crash:
android.content.res.Resources$NotFoundException: failed to add asset path /mnt/asec/com.P1.xxx/base.apk
at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:281)
at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:359)
at android.app.ResourcesManager.getOrCreateResources(ResourcesManager.java:638)
at android.app.ResourcesManager.getResources(ResourcesManager.java:730)
at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2052)
at android.app.LoadedApk.getResources(LoadedApk.java:787)
at android.app.ContextImpl.<init>(ContextImpl.java:2266)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2210)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2196)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5861)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
Please check if the App has external drive permissions.
In my case this issue triggered when ADB installed the App to the device which is screen locked, the same test has passed when the device is awake, so even though permissions available to this App
I have this error for com.android.billingclient:billing. Problem is "there is no account in the device", for example a new device or reset to vendor settings.
So just add an account in global settings.

Google Sign In is failing only on (some) Xiaomi devices

I am using Google Sign In in my application. I am using google play services version 9.0.2
compile 'com.google.android.gms:play-services-plus:9.0.2'
It was working fine for all devices, but now I am getting crash logs from Crashlytics and the crash is only happening on Xiaomi devices. Here are the crash logs.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eterno/com.google.android.gms.auth.api.signin.internal.SignInHubActivity}: java.lang.IllegalStateException: Bad magic number for Bundle: 0xffff4f45
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Caused by java.lang.IllegalStateException: Bad magic number for Bundle: 0xffff4f45
at android.os.Parcel.readException(Parcel.java:1628)
at android.os.Parcel.readException(Parcel.java:1573)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2661)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1509)
at android.app.Activity.startActivityForResult(Activity.java:3978)
at android.app.Activity.startActivityForResult(Activity.java:3939)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:842)
at com.google.android.gms.auth.api.signin.internal.SignInHubActivity.zza(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.SignInHubActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:6303)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
I am not able to reproduce the crash with any of the test devices that we can locally with us. Did any one else also face this issue with Xiaomi devices? Also, will upgrading the google play services version help in mitigating the issue?
P.S. I am not attaching code snippets which I wrote for Google Sign In because it is working for all other devices. This seems to be a specific problem related to Xiaomi devices.
Checkout out the playService App Version in device
I was getting same problem in my code. I found that release app is not working on those Xiaomi devices installed debug build.
I tried same release app without changing a single line of code on a different Xiaomi android phone and found app is working fine.
I didn't tried but this might be possible that resetting Xiaomi devices solve this problem.

Is there a workaround for using espresso with Lollipop (Android 21)?

Attempting to run a test with UI-related code using espresso (i.e. GoogleInstrumentationTestRunner) on a Nexus 7 with Lollipop gives the following error:
java.lang.IllegalStateException: This message cannot be recycled because it is still in use.
at android.os.Message.recycle(Message.java:279)
at com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:468)
at com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl.loopMainThreadUntilIdle(UiControllerImpl.java:337)
at com.google.android.apps.common.testing.ui.espresso.ViewInteraction$1.run(ViewInteraction.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
This has apparently been a known issue for several months but since there have been no commits since January 8, it is unknown whether there will be an official fix.
There is a comment in the discussion thread that states
Just removing message.recycle(); seems to fix it...
Is this a valid workaround? If not, what would the correct fix be?
UPDATE: Use Espresso 2.0 for Lollipop support
https://code.google.com/p/android-test-kit/wiki/EspressoSetupInstructions
Yes, if you remove "message.recycle(); " and rebuild it will solve that problem.
The Espresso team announced at GTAC that the next release of Espresso will be in AOSP before too long. See video here: https://www.youtube.com/watch?v=aHcmsK9jfGU
( I was the original poster of that issue you referenced )
UPDATE:
// you will want to keep it for older API versions
if ( SDK_INT < 21 ){
message.recycle();
}

Categories

Resources