sinch video call camera permission problem with Android pei (9) - java

update
I am developing a small app which requires camera permission. I can handle the run time permission but the real problem is that when I relay to Sinchpayload and go to incomming call activity. This activity should request permissions (camera and other 2 permissions). But instead of showing the permission dialogue, it crash my app because of security exception. this thing happen only if I request camera permission - not happen to other permissions and only on Android 9 with camera "2" Api - Android 8.1 and lower works fine . THIS PROBLEM STILL HAPPEN WITH THE SINCH SAMPLE PUSH. The permission dialogue will show if start activity with intent as usual. This is the error :
-------- beginning of crash
2019-02-10 22:11:55.390 2113-2681/com.example.myapp.app E/AndroidRuntime: FATAL EXCEPTION: VideoCapturerThread
Process: com.example.myapp.app, PID: 2113
java.lang.SecurityException: validateClientPermissionsLocked:1054: Caller "com.example.myapp.app" (PID 10319, UID 2113) cannot open camera "1" without camera permission
at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:747)
at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:405)
at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:567)
at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:495)
at org.webrtc.Camera2Session.openCamera(Unknown Source:44)
at org.webrtc.Camera2Session.start(Unknown Source:60)
at org.webrtc.Camera2Session.<init>(Unknown Source:73)
at org.webrtc.Camera2Session.create(Unknown Source:17)
at org.webrtc.Camera2Capturer.createCameraSession(Unknown Source:17)
at org.webrtc.CameraCapturer$5.run(Unknown Source:52)
at android.os.Handler.handleCallback(Handler.java:891)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: android.os.ServiceSpecificException: validateClientPermissionsLocked:1054: Caller "com.example.myapp.app" (PID 10319, UID 2113) cannot open camera "1" without camera permission (code 1)
at android.os.Parcel.createException(Parcel.java:1967)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at android.hardware.ICameraService$Stub$Proxy.connectDevice(ICameraService.java:343)
at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:369)
at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:567) 
at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:495) 
at org.webrtc.Camera2Session.openCamera(Unknown Source:44) 
at org.webrtc.Camera2Session.start(Unknown Source:60) 
at org.webrtc.Camera2Session.<init>(Unknown Source:73) 
at org.webrtc.Camera2Session.create(Unknown Source:17) 
at org.webrtc.Camera2Capturer.createCameraSession(Unknown Source:17) 
at org.webrtc.CameraCapturer$5.run(Unknown Source:52) 
at android.os.Handler.handleCallback(Handler.java:891) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:207) 
at android.os.HandlerThread.run(HandlerThread.java:65)`
and this is my code to request permissions :
if (Build.VERSION.SDK_INT>=23)
{
if (GlobalConstants.isAllPermissionsGrantedBefore_Video_Call(this)==false)
ActivityCompat.requestPermissions(
Video_incomming_call.this,
GlobalConstants.mPermissions_Video_Chat,
GlobalConstants.VIDEO_RECIEVE_CODE);
else {
Start_Calling();
}
} else Start_Calling();

The app permission dialog only shows in foreground.

Related

Why location doesn't work in app with android 10?

I have an app which streams video and it ensure making photos from another device. It is saving location of device in photo information. It works correctly on older android versions for example 6.0 Unfortunately it doesn't work on android 10 even after updating an app to SDK 29. Do you have any ideas?
When I switch off gps in android 10 phone everything goes well.
Below errors from android studio:
E/i.aoiAgent11EN: Unknown bits set in runtime_flags: 0x8000
I/Perf: Connecting to perf service.
I/FeatureParser: can't find cepheus.xml in assets/device_features/,it may be in /system/etc/device_features
E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
E/Perf: Fail to get file list pl.biz.aoi.aoiAgent11ENG
getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
Fail to get file list pl.biz.aoi.aoiAgent11ENG
getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
E/AudioPlayer: CPP is working
java.lang.IllegalStateException: Unable to retrieve AudioTrack pointer for getPosition()
at android.media.AudioTrack.native_get_position(Native Method)
at android.media.AudioTrack.getPlaybackHeadPosition(AudioTrack.java:1699)
at pl.biz.aoi.aoiAgent11ENG.media.in.audio.player.SpeakerOutputStream.getPlayed(SpeakerOutputStream.java:46)
at pl.biz.aoi.aoiAgent11ENG.media.in.audio.player.G711AudioPlayer.writeSilenceBufferIfNeeded(G711AudioPlayer.java:136)
at pl.biz.aoi.aoiAgent11ENG.media.in.audio.player.G711AudioPlayer.run(G711AudioPlayer.java:111)
at java.lang.Thread.run(Thread.java:919)
I/chatty: uid=10262(pl.biz.aoi.aoiAgent11ENG) identical 18 lines
E/AudioPlayer: CPP is working
java.lang.IllegalStateException: Unable to retrieve AudioTrack pointer for getPosition()
at android.media.AudioTrack.native_get_position(Native Method)
at android.media.AudioTrack.getPlaybackHeadPosition(AudioTrack.java:1699)
at pl.biz.aoi.aoiAgent11ENG.media.in.audio.player.SpeakerOutputStream.getPlayed(SpeakerOutputStream.java:46)
at pl.biz.aoi.aoiAgent11ENG.media.in.audio.player.G711AudioPlayer.writeSilenceBufferIfNeeded(G711AudioPlayer.java:136)
at pl.biz.aoi.aoiAgent11ENG.media.in.audio.player.G711AudioPlayer.run(G711AudioPlayer.java:111)
at java.lang.Thread.run(Thread.java:919)

how to fix google+ login connection in android?

Hi I'm android beginner
My code had worked a few days ago , suddenly there was problem
How did these errors come from?
Error log
05-18 11:01:52.756 710-722/? E/DatabaseUtils: Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:15401)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2512)
at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:685)
at android.content.ContentProvider$Transport.call(ContentProvider.java:325)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:275)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
....
05-18 11:01:52.796 748-748/com.buttering.roler E/Login_Activity: Connection to Play Services Failed, error: 4, reason: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{426e34f0: android.os.BinderProxy#423cbdb8}, message=null}
05-18 11:01:52.796 710-1728/? E/Parcel: Class not found when unmarshalling: com.google.android.gms.common.api.Scope
java.lang.ClassNotFoundException: com.google.android.gms.common.api.Scope
at java.lang.Class.classForName(Native Method)
it clearly say
Connection to Play Services Failed, error: 4, reason: ConnectionResult{statusCode=SIGN_IN_REQUIRED
SIGNIN_REQUIRED
public static final int SIGN_IN_REQUIRED
The client attempted to connect to the service but the user is not
signed in. The client may choose to continue without using the API.
Alternately, if hasResolution() returns true the client may call
startResolutionForResult(Activity, int) to prompt the user to sign in.
After the sign in activity returns with RESULT_OK further attempts
should succeed.
Constant Value: 4

java.lang.SecurityException: Permission Denial: starting Intent {act=android.settings.USAGE_ACCESS_SETTINGS}

I get java.lang.SecurityException when try to startActivityForResult(intent, requestCode); with final Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS); intent. Interesting that this crash happens only on Huawei with Android 5.1 - 5.1.1
I haven't Huawei device. Could you please give me advice what it can be.
Stacktrace
Fatal Exception: java.lang.SecurityException: Permission Denial: starting Intent { act=android.settings.USAGE_ACCESS_SETTINGS cmp=com.android.settings/.Settings$UsageAccessSettingsActivity } from ProcessRecord{11b5f1a1 19764:com.myproject.my/u0a167} (pid=19764, uid=10167) not exported from uid 1000
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1499)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2448)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1496)
at android.app.Activity.startActivityForResult(Activity.java:3794)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:77)
at android.app.Activity.startActivityForResult(Activity.java:3755)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
at com.myproject.my.utils.PermissionsHelper$2.onClick(PermissionsHelper.java:134)
at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:157)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5298)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)
For whatever reason, Huawei left the <intent-filter> in place for this activity, but they marked it as not exported. There is no way that you can start the activity. All you can do is catch the exception and explain to the user that you cannot navigate there.
According to android developer documentation.
In some cases, a matching Activity may not exist, so ensure you
safeguard against this.
Link : ACTION_USAGE_ACCESS_SETTINGS

Android media.AudioTrack.finalize Throwing IllegalStateException: Binder has been finalized

I am using a custom camera to record Videos on android.
The device experiencing the issue is a Nexus 5 with Android 6.0.1 on it.
When the camera finishes recording for only for the 2nd time, i get the following exception in the under-the-hood android media AudioTrack class. This is something that is called implicitly by android, by the FinalizerDaemon, and not as a result of any code I execute directly. So the FinalizerDaemon calls finalize on AudioTrack, and gets an IllegalStateException.
12-02 09:20:23.155 23705-23714/social.ivideo.greetings E/System: Uncaught exception thrown by finalizer
12-02 09:20:23.160 23705-23714/social.ivideo.greetings E/System: java.lang.IllegalStateException: Binder has been finalized!
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:615)
at com.android.internal.app.IAppOpsService$Stub$Proxy.stopWatchingMode(IAppOpsService.java:435)
at android.media.PlayerBase.baseRelease(PlayerBase.java:136)
at android.media.AudioTrack.finalize(AudioTrack.java:979)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)
Perhaps I need to do some sort of clean up when the camera finishes recording? Here's the current code I'm using when the recording stops:
#Override
public void stopRecording(boolean wasCancelled, float duration) {
if (mMediaRecorder != null) {
mMediaRecorder.stop();
mMediaRecorder.reset();
if (flashState) {
toggleFlash();
}
if (!wasCancelled) {
callbacks.onFinishedRecording(null, mediaPath, duration, wasCancelled);
}
}
}
mMediaRecorder is an instance of MediaRecorder class.
Any suggestions?
So I think this might be an Android bug. Looks suspiciously like this issue, which is marked as fixed in a "future version": https://issuetracker.google.com/issues/37138597
Same Issue Reported in Android 7.1.2
fixed in Android 8.0 https://android.googlesource.com/platform/frameworks/base/+log/aee6ee94675d56e71a42d52b16b8d8e5fa6ea3ff/media/java/android/media/PlayerBase.java

Android app crashing java.lang.NoSuchMethodError

I am getting crash on this activity when I run the app. This is not due to appcompat as you can see in the stack trace. This is native android ListView class whose method is not found while running the app.
The same app is running properly on other devices. The minSdkVersion = 13 target =23 max =23 and current device of crashing is API 17.
FATAL EXCEPTION: main
java.lang.NoSuchMethodError: android.widget.ListView.setElevation
at com.example.saloni.laughgurumarketingapp.ContentDetails.getValues(ContentDetails.java: 392)
at com.example.saloni.laughgurumarketingapp.ContentDetails.onCreate(ContentDetails.java: 298)
at android.app.Activity.performCreate(Activity.java: 5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2358)
at android.app.ActivityThread.access$600(ActivityThread.java: 156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1340)
at android.os.Handler.dispatchMessage(Handler.java: 99)
at android.os.Looper.loop(Looper.java: 153)
at android.app.ActivityThread.main(ActivityThread.java: 5297)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java: 511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 600)
at dalvik.system.NativeStart.main(Native Method)
In the code it's just a set elevation method on which it is crashing as you can see in the trace. Similarly it crashed last time on using one of the TextView class method. Why is this happening?
There is no setElevation() method in api 17. You need to only call this on api 21 and higher.
https://developer.android.com/reference/android/view/View.html#setElevation(float)
If you want to call this method on api 21 devices do this:
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP){
// Do something for lollipop and above versions
} else{
// do something for phones running an SDK before lollipop
}
You can use ViewCompat.setElevation and your app won't crash on pre-21 systems; however it won't have any effect on those older devices either.

Categories

Resources