Android permissions checkSelfPermission doesn't work - android

In the AndroidManifest.xml of my app I specified a target API to 26:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javasrv"
android:minSdkVersion="23"
android:targetSdkVersion="26"
android:versionCode="6"
android:versionName="1.0.0">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
But when I am running the app on Android x86 8.1 and disabling the permission for storage access through system menu it says that "This app was designed for an older version of Android. Denying permission may cause it to no longer function as intended."
How can it be?
Also I am having a problem with runtime permissions check: it always deems that the access is granted even though I disabled it in the system settings:
if (ContextCompat.checkSelfPermission(LoaderActivity.this, permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(LoaderActivity.this, "PERMISSION_DENIED", Toast.LENGTH_SHORT).show();
Log.d("*** Loader::onCreate ***", "PERMISSION_DENIED");
if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission.WRITE_EXTERNAL_STORAGE)) {
} else {
}
ActivityCompat.requestPermissions(this, new String[]{permission.WRITE_EXTERNAL_STORAGE}, 0);
} else {
Toast.makeText(LoaderActivity.this, "PERMISSION_GRANTED", Toast.LENGTH_SHORT).show();
Log.d("*** Loader::onCreate ***", "PERMISSION_GRANTED");
}
Again, it is unclear how can it be. Any ideas?
Edit: I am using android api v26 and android support library v23.
The compilation script:
file=javasrv.apk
# export CLASSPATH=/opt/android-sdk/platforms/android-26/android.jar:/opt/android-sdk/extras/android/support-library/23.2.1/android-support-v4.jar
#
rm -f com/javasrv/*.class
javac -cp $CLASSPATH -source 1.8 -target 1.8 com/javasrv/*.java
#dx --dex --output classes.dex com/javasrv/*.class
dx --dex --output classes.dex com/javasrv/*.class android/support/v4/app/*.class android/support/v4/content/*.class
#aapt package -f -m -F "$file" -M AndroidManifest.xml -S res -I "$CLASSPATH"
#aapt add "$file" classes.dex
rm -rf build && mkdir build
find ./res -type f | grep -vE '\.sw.$' | xargs -I{} aapt2 compile -o build "{}" --no-crunch
aapt2 link -R build/* --manifest AndroidManifest.xml $(echo "$CLASSPATH" | tr -d '\n' | xargs -d':' -L1 -I{} echo " -I {} ") -o "$file" --auto-add-overlay
zip -uj "$file" classes.dex
zipalign -f 4 "$file" "$file.aligned"
mv -f "$file.aligned" "$file"
apksigner sign --ks-pass pass:pwd --ks javasrv.keystore "$file"
Edit2: Here is another may be related to this one problem concerning aapt2. If I specify compileSdkVersion in AndroidManifest.xml it throws an error:
AndroidManifest.xml:2: error: attribute android:compileSdkVersion not found.
error: failed processing manifest.
I simply ignored it by removing compileSdkVersion from the manifest. I wonder now if I should not...
Edit3: As related to logcat of that permission check. I only have access to /data/log.txt. But it should be enough. No?
08-16 19:24:39.236 18965 18965 E /system/bin/webview_zygote32: Failed to make and chown /acct/uid_99182: Permission denied
08-16 19:24:39.236 18965 18965 E Zygote : createProcessGroup(99182, 0) failed: Permission denied
08-16 19:24:39.239 2219 2900 I am_proc_start: [0,18965,99182,com.android.chrome:sandboxed_process0,webview_service,com.javasrv/org.chromium.content.app.SandboxedProcessService0]
08-16 19:24:39.239 2219 2900 I ActivityManager: Start proc 18965:com.android.chrome:sandboxed_process0/u0i182 for webview_service com.javasrv/org.chromium.content.app.SandboxedProcessService0
08-16 19:24:39.255 18965 18965 W /system/bin/webview_zygote32: Unexpected CPU variant for X86 using defaults: x86_64
08-16 19:24:39.256 18931 18931 I auditd : type=1400 audit(0.0:3392): avc: denied { read } for comm="com.javasrv" name="vmstat" dev="proc" ino=4026531858 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=1
08-16 19:24:39.256 18931 18931 I com.javasrv: type=1400 audit(0.0:3392): avc: denied { read } for name="vmstat" dev="proc" ino=4026531858 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=1
08-16 19:24:39.256 18931 18931 I auditd : type=1400 audit(0.0:3393): avc: denied { open } for comm="com.javasrv" path="/proc/vmstat" dev="proc" ino=4026531858 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=1
08-16 19:24:39.256 18931 18931 I com.javasrv: type=1400 audit(0.0:3393): avc: denied { open } for path="/proc/vmstat" dev="proc" ino=4026531858 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=1
08-16 19:24:39.263 18959 18959 W zygote : Unexpected CPU variant for X86 using defaults: x86_64
08-16 19:24:39.281 1022 1022 I auditd : type=1400 audit(0.0:3395): avc: denied { read } for comm="loop0" path="/mnt/android-8.1-r2/system.img" dev="vda2" ino=1422631 scontext=u:r:kernel:s0 tcontext=u:object_r:unlabeled:s0 tclass=file permissive=1
08-16 19:24:39.281 1022 1022 I loop0 : type=1400 audit(0.0:3395): avc: denied { read } for path="/mnt/android-8.1-r2/system.img" dev="vda2" ino=1422631 scontext=u:r:kernel:s0 tcontext=u:object_r:unlabeled:s0 tclass=file permissive=1
08-16 19:24:39.289 2671 2691 D SubscriptionController: [getPhoneId] asked for default subId=-1
08-16 19:24:39.290 2671 2691 D SubscriptionController: [getSubId]- invalid slotIndex=-1
08-16 19:24:39.336 18931 18931 D *** Loader::onCreate ***: PERMISSION_GRANTED
08-16 19:24:39.336 18931 18931 D *** getListFiles ***: [W]/sdcard/Download/FDroid.apk
08-16 19:24:39.336 18931 18931 D *** getListFiles ***: [W]/sdcard/Download/javasrv.apk
Edit4:
This is how the activity from which I am requesting permissions gets started:
Intent intent = new Intent(this, LoaderActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// If set in an Intent passed to Context.startActivity(), this flag will cause any existing task that would be associated with the activity to be cleared before the activity is started. That is, the activity becomes the new root of an otherwise empty task, and any old activities are finished. This can only be used in conjunction with FLAG_ACTIVITY_NEW_TASK.
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
Edit 5:
Holy cow! I just decompiled the resulted apk and noticed that somehow my android:versionCode and android:versionName became platformbuildversioncode and platformbuildversionname respectively. This is nuts! I wonder how the hell it happened.
Added: Uh oh. It is somehow related to the version of aapt2. I used from build-tools 28.0.3. In changed it to 26.0.2 and it behaved without that insanity.
Edit 6:
Due to the bugs with aapt2, I reverted back to aapt. At least it doesn't messing up the manifest too much:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:minSdkVersion="23" android:targetSdkVersion="26" package="com.javasrv" platformBuildVersionCode="26" platformBuildVersionName="8.0.0">
For some reason it excised my app custom version number and version code though. But at least that should not affect the work of an app.
What I am still struggling with though is that I cannot specify compileSdkVersion due to the same error that compileSdkVersion was not found in the package android.
Edit 7: Alright. Here is the head of the manifest that I decompiled from the final apk(which I built with aapt2 v26):
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:minSdkVersion="23" android:targetSdkVersion="26" package="com.javasrv">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
So the only thing is missing is compileSdkVersion. I still can't figure out how to make aapt2 put that value into the manifest. But I tested that apk and the bug with runtime permissions still persist. Very strange.
Edit 8:
Installed the latest aapt2 version. From here: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.6.0-alpha11-5720371/aapt2-3.6.0-alpha11-5720371-linux.jar
Still the same thing - it would not insert compileSdkVersion.
Edit 9:
Actually it is pretty clear that compiledSdkVersion isn't present in the namespace I am using. I also cannot find it anywhere in the docs: https://developer.android.com/guide/topics/manifest/uses-sdk-element
It appears to me that I should not use it at all - and actually I don't see any purpose in it. Who the hell cares with what version I compiled my app, if I can just specify the minimum and target versions? So the bug should be somewhere else.
Edit 10:
Updated up to 24.1.1 version of Android Support Library. Stilll no luck with the check of runtime permissions.
Edit 11:
Tried to call requestPermissions even though it falsily detects it as GRANTED and got a runtime error: that classs android.support.v4.app.ActivityCompatApi23 was not found. Interesting...
Hm. Apparently I should've used Android Support Library the same version as my SDK. But it is unclear for me how to get a jar of the latest version of a support library (see Install latest android support library CLI )
So yeah. Probably it was a bad idea just to extract the jar file from 24.1.1's aar - apparently it wasn't the whole library but just a patch. So I decided to use jar 23.2.1 which some guy compiled: https://github.com/pbakondy/cordova-plugin-android-support-v4-jar
Edit 12:
With v23.2.1 android support library back in place I decided to call requestPermissions right after I called Log.d with PERMISSION_GRANTED message. Here is the output:
08-17 12:50:15.132 28837 28837 D *** Loader::onCreate ***: PERMISSION_GRANTED
08-17 12:50:15.136 28837 28891 I com.javasrv: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
08-17 12:50:15.139 2219 2600 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.google.android.packageinstaller cmp=com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity (has extras)} from uid 10081
08-17 12:50:15.141 2219 2600 I wm_task_moved: [179,1,6]
08-17 12:50:15.142 2219 2600 I am_create_activity: [0,28890900,179,com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity,android.content.pm.action.REQUEST_PERMISSIONS,NULL,NULL,8388608]
08-17 12:50:15.147 2219 2600 I am_pause_activity: [0,43511476,com.javasrv/.LoaderActivity]
08-17 12:50:15.182 2446 2446 V StatusBar: setLightsOn(true)
08-17 12:50:15.183 28837 28837 I am_on_resume_called: [0,com.javasrv.LoaderActivity,LAUNCH_ACTIVITY]
08-17 12:50:15.254 28837 28873 W cr_media: Requires BLUETOOTH permission
08-17 12:50:15.273 28837 28837 I am_on_paused_called: [0,com.javasrv.LoaderActivity,handlePauseActivity]
08-17 12:50:15.284 2219 2259 I am_restart_activity: [0,28890900,179,com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity]
08-17 12:50:15.285 2219 2259 I am_set_resumed_activity: [0,com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity,minimalResumeActivityLocked]
08-17 12:50:15.291 2219 2298 I sysui_count: [window_time_0,3]
08-17 12:50:15.291 2219 2298 I sysui_multi_action: [757,803,799,window_time_0,802,3]
08-17 12:50:15.297 2446 2446 V StatusBar: setLightsOn(true)
08-17 12:50:15.304 2219 5022 I am_finish_activity: [0,28890900,179,com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity,app-request]
08-17 12:50:15.305 2219 5022 I am_pause_activity: [0,28890900,com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity]
08-17 12:50:15.308 2219 2298 I sysui_count: [window_time_0,0]
08-17 12:50:15.308 2219 2298 I sysui_multi_action: [757,803,799,window_time_0,802,0]
08-17 12:50:15.439 2219 2259 I am_set_resumed_activity: [0,com.javasrv/.LoaderActivity,resumeTopActivityInnerLocked]
08-17 12:50:15.446 2219 2259 I am_resume_activity: [0,43511476,179,com.javasrv/.LoaderActivity]
08-17 12:50:15.457 2219 2298 I sysui_count: [window_time_0,0]
08-17 12:50:15.457 2219 2298 I sysui_multi_action: [757,803,799,window_time_0,802,0]
08-17 12:50:15.557 2446 2446 I chatty : uid=10030(com.android.systemui) identical 5 lines
08-17 12:50:15.594 2446 2446 V StatusBar: setLightsOn(true)
No dialog appeared. It looks like the system makes the app think that the permission was granted.
I wonder why ... there must be something wrong with the manifest, but what?
I will output the whole manifest via apkanalyzer:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:minSdkVersion="23"
android:versionCode="6"
android:versionName="1.0.0"
android:targetSdkVersion="26"
package="com.javasrv">
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="#ref/0x7f060000"
android:icon="#ref/0x7f020000">
<activity
android:theme="#ref/0x010300f0"
android:label="#ref/0x7f060000"
android:name="com.javasrv.MainActivity">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:theme="#ref/0x010300f0"
android:label="#ref/0x7f060000"
android:name="com.javasrv.LoaderActivity">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:theme="#ref/0x01030011"
android:label="#string/0xb"
android:icon="#ref/0x7f010000"
android:name="com.javasrv.TestActivity"
android:screenOrientation="1">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name=".MyTestService" />
<service
android:name=".MyJobService"
android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver
android:name="Boot">
<intent-filter
android:priority="100">
<action
android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
Any ideas?
THE PROBLEM HAS BEEN SOLVED

May be this can help you.
Just make your in your app gradle you have compileSdkVersion and targetSdkVersion as 26.

If checkpermission is not working you can try the dialog permission
When your app receives PERMISSION_DENIED from checkSelfPermission(), you need to prompt the user for that permission. Android provides several methods you can use to request a permission, such as requestPermissions().
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
1);
Then override the method
#Override
public void onRequestPermissionsResult(int requestCode, #NonNull String[] permissions, #NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 1: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted
} else {
// permission denied
Toast.makeText(BiggerScreen.this, "Permission denied to write your External storage", Toast.LENGTH_SHORT).show();
}
return;
}
// other 'case' lines to check for other
// permissions this app might request
}
}

Wow. All that time the problem was with AndroidManifest.xml. I specified minSdkVersion in the wrong place. I should've done that in uses-sdk xml tag, not in manifest tag, just like on the Android Developer website is written: https://developer.android.com/guide/topics/manifest/uses-sdk-element
I don't know where I picked up an idea that these attributes should be written in manifest tag. Perhaps this is what gradle is doing - it transfers the attributes when compiling the apk..
Edit: In addition, one have to restart the app after permission has been granted. Otherwise, checkSelfPermission will inform that acccess has been granted, but the app will not have any access to the files: Writing external storage doesn't work until I restart the application on Android M

Related

Flutter app crash on startup with release apk, but runs fine with 'flutter run'

New to flutter/mobile development. Had to do a bit of R&D to get what i need in a mobile app, I'm stuck at the very end of the finish line. i.e making my .apk work on the actual device.
I've tried installing app with flutter install and by transferting build\app\outputs\apk\release\app-arm64-v8a-release.apk on to my device.
App get installed successfully, but crashes immediately on the start.
On the other hand It builds and runs fine with flutter run, on both emulator and on physical device (s10+)
Build
flutter build apk --split-per-abi --obfuscate --split-debug-info=/MyApp/
Running "flutter pub get" in Myapp... 0.8s
Removed unused resources: Binary resource data reduced from 494KB to 479KB: Removed 2%
Removed unused resources: Binary resource data reduced from 494KB to 479KB: Removed 2%
Removed unused resources: Binary resource data reduced from 494KB to 479KB: Removed 2%
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 75.5s
√ Built build\app\outputs\flutter-apk\app-armeabi-v7a-release.apk (6.0MB).
No plan to publish it on the Play Store, it has to be used internally and i'm stuck at the very end of my work. Any word of advice what to look for to solve this?
Update
Logcat set to Error
2020-09-30 00:00:12.918 2472-9529/? E/pageboostd: prefetch start : app comstsltdstevenspin
2020-09-30 00:00:12.919 507-507/? E/audit: type=1400 audit(1601420412.917:20565): avc: denied { search } for pid=2472 comm="pageboostd" name="com.stsltd.stevenspin" dev="sda31" ino=1708995 scontext=u:r:pageboostd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-G975F_10_0020 audit_filtered
2020-09-30 00:00:12.919 507-507/? E/audit: type=1400 audit(1601420412.917:20566): avc: denied { search } for pid=2472 comm="pageboostd" name="com.stsltd.stevenspin" dev="sda31" ino=1708995 scontext=u:r:pageboostd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-G975F_10_0020 audit_filtered
2020-09-30 00:00:12.921 2472-9529/? E/pageboostd: comstsltdstevenspin, amt 48201728 scnt 15 fcnt 35
2020-09-30 00:00:12.921 2472-9529/? E/pageboostd: prefetch end : app comstsltdstevenspin data_amount 48201728
2020-09-30 00:00:13.125 2472-9530/? E/pageboostd: active launch start : app comexampleStevensPin
2020-09-30 00:00:13.125 2472-9530/? E/pageboostd: comexampleStevensPin, amt 1536600 scnt 2 fcnt 0
2020-09-30 00:00:13.126 2472-9530/? E/pageboostd: comexampleStevensPin, amt 0 scnt 2 fcnt 0
2020-09-30 00:00:13.126 2472-9530/? E/pageboostd: active launch end : app comexampleStevensPin data_amount 1536600
2020-09-30 00:00:13.145 7174-7174/? E/mple.StevensPi: Not starting debugger since process cannot load the jdwp agent.
2020-09-30 00:00:13.481 572-572/? E/Layer: [Surface(name=AppWindowToken{8f83aa6 token=Token{a332c01 ActivityRecord{6c5ede8 u0 com.example.StevensPin/.MainActivity t2284}}})/#0xb5d144d - animation-leash#0] No local sync point found, barrierLayer : [com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity$_1923#0]
2020-09-30 00:00:13.560 7174-7174/? A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7174 (mple.StevensPin), pid 7174 (mple.StevensPin)
2020-09-30 00:00:13.580 1025-1121/? E/WindowManager: win=Window{96f549b u0 Splash Screen com.example.StevensPin EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:1248 com.android.server.wm.AppWindowToken.destroySurfaces:1229 com.android.server.wm.WindowState.onExitAnimationDone:5182 com.android.server.wm.WindowStateAnimator.onAnimationFinished:320 com.android.server.wm.WindowState.onAnimationFinished:5623 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0$SurfaceAnimator:100
2020-09-30 00:00:13.603 9594-9594/? A/DEBUG: pid: 7174, tid: 7174, name: mple.StevensPin >>> com.example.StevensPin <<<
2020-09-30 00:00:13.604 9594-9594/? A/DEBUG: #01 pc 00157a3f /data/app/com.example.StevensPin-pGnjhn3RCPRS-R-mc79c5Q==/lib/arm/libflutter.so (BuildId: e975fb1af56ffc3c5acc61eaa8e0aba1720b5000)
2020-09-30 00:00:13.604 9594-9594/? A/DEBUG: #02 pc 004e1a38 /data/app/com.example.StevensPin-pGnjhn3RCPRS-R-mc79c5Q==/lib/arm/libflutter.so!libflutter.so (offset 0x4e0000) (BuildId: e975fb1af56ffc3c5acc61eaa8e0aba1720b5000)
2020-09-30 00:00:14.003 507-507/? E/audit: type=1701 audit(1601420414.001:20595): auid=4294967295 uid=10309 gid=10309 ses=4294967295 subj=u:r:untrusted_app_27:s0:c53,c257,c512,c768 pid=7174 comm="mple.StevensPin" exe="/system/bin/app_process32" sig=6 res=1
2020-09-30 00:00:14.090 1025-1308/? E/InputDispatcher: channel 'f4478b2 com.example.StevensPin/com.example.StevensPin.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2020-09-30 00:00:14.094 1025-1433/? E/WindowManager: win=Window{f4478b2 u0 com.example.StevensPin/com.example.StevensPin.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:1248 com.android.server.wm.AppWindowToken.destroySurfaces:1229 com.android.server.wm.WindowState.onExitAnimationDone:5182 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.AppWindowToken.onAnimationFinished:3931 com.android.server.wm.AppWindowToken.commitVisibility:913
2020-09-30 00:00:14.525 2472-9613/? E/pageboostd: prefetch start : app comstsltdstevenspin
2020-09-30 00:00:14.526 507-507/? E/audit: type=1400 audit(1601420414.525:20596): avc: denied { search } for pid=2472 comm="pageboostd" name="com.stsltd.stevenspin" dev="sda31" ino=1708995 scontext=u:r:pageboostd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SM-G975F_10_0020 audit_filtered
2020-09-30 00:00:14.528 2472-9613/? E/pageboostd: comstsltdstevenspin, amt 48201728 scnt 15 fcnt 35
2020-09-30 00:00:14.529 2472-9613/? E/pageboostd: prefetch end : app comstsltdstevenspin data_amount 48201728
Update 2
While searching online i've found that similar issue happened if you are using a third party lib and try shrinking the build.
I'm using msal_mobile for authenticating user at the beginning. If i don't shrink my build
flutter build apk --no-shrink
Now the app works and doesn't crash.
On the other hand if I avoid the following msal_mobile initializing code, and build the apk with shrinking enabled flutter build apk, which uses R8 to shrink, app doesn't crash again.
class _MyAppState extends State<MyApp> {
MsalMobile msal;
#override
void initState() {
super.initState();
MsalMobile.create('assets/auth_config.json', "https://login.microsoftonline.com/Organizations").then((client) {
setState(() {
msal = client;
});
});
}
}
Is there some different approach to shrink the app when u are using lib that causes such issue.
I encountered the same error and narrowed the problem down to the msal_mobile package having issues invoking platform-specific functionality with its method channels (specifically Line 39 of msal_mobile.dart).
Based on what I read here, it seems like the Android modification and obfuscation process ends up being a bit overzealous when renaming methods, making the method channels used in the msal_mobile package think that the method they are trying to call doesn't exist.
The only solution that I found to work for my own situation isn't ideal, as it increases the size of my app, but it got my project working again, so I thought I would share.
In your project's directory, open the file android/app/build.gradle and add the following lines to the release section of buildTypes:
buildTypes {
release {
signingConfig signingConfigs.debug
minifyEnabled false // Add this line
shrinkResources false // Add this line
useProguard false // Add this line
}
}
I hope this helps a bit!

Se-policy error in Android -N in user debug build

I am seeing following sepolicy errors in Android-N.
W Binder:3929_E: type=1400 audit(0.0:29): avc: denied { write } for path="/dev/ttyGS0" dev="tmpfs" ino=73461 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:serial_ic:s0 tclass=chr_file permissive=0
I have created directory "vendor/qcom/sepolicy/acm/" and made its entry in BoardConfig.mk as shown below.
# ACM features belong in vendor/qcom/sepolicy
BOARD_SEPOLICY_DIRS := vendor/qcom/sepolicy/acm
Also I have commented in "device/qcom/sepolicy/common/file_contexts"
-/dev/ttyGS0 u:object_r:gadget_serial_device:s0
+#/dev/ttyGS0 u:object_r:gadget_serial_device:s0
I have changed sepolicy in following directories:
[1] vendor/qcom/sepolicy/acm/file_contexts
# These are the ports used to talk.
# We have to relabel these because domain.te has never allow rules that prevent
# any other domain (other than init or ueventd) from accessing these files
/dev/ttyGS0 u:object_r:serial_ic:s0
[2] vendor/qcom/sepolicy/acm/file.te
type serial_ic, dev_type, fs_type;
[3] vendor/qcom/sepolicy/acm/platform_app.te
allow platform_app serial_ic:chr_file { ioctl open read write };
[4] vendor/qcom/sepolicy/acm/system_server.te
#allow for acm node
allow system_server serial_ic:chr_file rw_file_perms;
[5] vendor/qcom/sepolicy/acm/untrusted_app.te
# for serial chat app
allow untrusted_app serial_ic:chr_file ioctl;
allow untrusted_app serial_ic:chr_file { read write };
[6] vendor/qcom/sepolicy/acm/system_app.te
#allow acm node
allow system_app serial_ic:chr_file { ioctl open read write};
Still I am not able to resolve "write" sepolicy error.Whenever from my serial chat application it tries to access node "/dev/ttyGS0" application crashes.
Posting logs for reference
--------- beginning of crash
01-01 07:11:46.954 15292 15292 E AndroidRuntime: FATAL EXCEPTION: main
01-01 07:11:46.954 15292 15292 E AndroidRuntime: Process: com.android.serialchat, PID: 15292
01-01 07:11:46.954 15292 15292 E AndroidRuntime: DeadSystemException: The system died; earlier logs will point to the root cause
01-01 07:11:46.960 3929 8483 W ActivityManager: Force finishing activity com.android.serialchat/.SerialChat
01-01 07:11:46.965 3929 8483 D ActivityTrigger: ActivityTrigger activityPauseTrigger
01-01 07:11:46.949 8597 8597 W Binder:3929_E: type=1400 audit(0.0:29): avc: denied { write } for path="/dev/ttyGS0" dev="tmpfs" ino=73461 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:serial_ic:s0 tclass=chr_file permissive=0

Android: App crashed on nougat devices

I have a sdk which has some native code. I am building the code into the shared libraries manually and copied those .so files to jniLibs folder. And I am using that sdk in an App. It was working fine with 5, 6 but with Nougat, it just got crashed every time I opened the App.
Note: I have updated the target version to 25 in the build.gradle file.
This is the error Log:
03-31 16:02:32.553 2050-2050/com.vinoth.sampleApp W/s.sampleApp: type=1400 audit(0.0:152): avc: denied { create } for uid=10156 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:untrusted_app:s0:c512,c768 tclass=netlink_kobject_uevent_socket permissive=0
03-31 16:02:32.553 2050-2050/com.vinoth.sampleApp W/s.sampleApp: type=1400 audit(0.0:153): avc: denied { read } for uid=10156 name="devices" dev="sysfs" ino=6380 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
[ 03-31 16:02:32.563 382: 382 W/ ]
debuggerd: handling request: pid=2050 uid=10156 gid=10156 tid=2050
I have searched about this but ended up with no clue.
Someone please help. Thanks in advance.

Packaging handheld and wearable Android app together from CLI [NativeScript]

I'm trying to build a Phone+Wear app with NativeScript for Android. I have been able to build both separately and to run them on the Android emulator also. The problem is that I'm unable to package them properly, I mean, I can't package them together in order to install only one APK, that will install the handheld app in the phone and push the wearable app into the watch.
Method and code
Even the post you wrote about Android Wear is quite outdated and the sample code repo is missing, I have been able to build a NativeScript app which APK runs properly in an Android Wear emulator.
I have also a normal phone app built with NativeScript that runs properly in the emulator and in my own device (described bellow).
I have tried to package the app following the steps described by the official documentation in the sections: "Signing the wearable and handheld app separately" and "Package Manually". I have tried both packaging methods but no one is working for me (the last one is also the one described in this post).
Bellow you can see the AndroidManifest.xml and app.gradle files of both applications and the commands that I'm executing to package the signed app:
Wearable App Files
bilbonbizi/wearable/package.json
"nativescript": {
"id": "com.berriart.bilbonbizi",
"tns-android": {
"version": "2.5.0"
}
},
bilbonbizi/wearable/app/App_Resources/Android/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-sdk
android:minSdkVersion="20"
android:targetSdkVersion="__APILEVEL__"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.location.network" />
<uses-feature android:name="android.hardware.type.watch" />
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault">
<activity
android:name="com.tns.NativeScriptActivity"
android:label="#string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="#style/LaunchScreenTheme">
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="#style/AppTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
</application>
</manifest>
bilbonbizi/wearable/app/App_Resources/Android/app.gradle
dependencies {
compile 'com.google.android.support:wearable:+'
}
android {
defaultConfig {
generatedDensities = []
applicationId = "com.berriart.bilbonbizi"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
Handled App Files
bilbonbizi/wearable/package.json
"nativescript": {
"id": "com.berriart.bilbonbizi",
"tns-android": {
"version": "2.5.0"
}
},
bilbonbizi/handheld/app/App_Resources/Android/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.location.network" />
<uses-feature android:name="android.hardware.type.watch" />
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<meta-data android:name="com.google.android.wearable.beta.app"
android:resource="#xml/wearable_app_desc"/>
<activity
android:name="com.tns.NativeScriptActivity"
android:label="#string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:theme="#style/LaunchScreenTheme">
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="#style/AppTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService" />
</application>
</manifest>
bilbonbizi/handheld/app/App_Resources/Android/app.gradle
android {
defaultConfig {
generatedDensities = []
applicationId = "com.berriart.bilbonbizi"
}
aaptOptions {
additionalParameters "--no-version-vectors"
noCompress "apk"
}
}
bilbonbizi/handheld/app/App_Resources/Android/xml/wearable_app_desc.xml
<wearableApp package="com.berriart.bilbonbizi">
<versionCode>1</versionCode>
<versionName>1.0</versionName>
<rawPathResId>wearable_app</rawPathResId>
</wearableApp>
Steps to package the app (steps to reproduce the issue)
The signing key used is the same for both:
cd bilbonbizi/wearable
tns platform remove android && tns platform add android && tns prepare android
tns build android --release --key-store-path [hiddenpath] --key-store-password [hiddenpass] --key-store-alias [hiddenalias] --key-store-alias-password [hiddenpass] --copy-to ../handheld/app/App_Resources/Android/raw/wearable_app.apk
cd ../handheld
tns platform remove android && tns platform add android && tns prepare android
tns build android --release --key-store-path [hiddenpath] --key-store-password [hiddenpass] --key-store-alias [hiddenalias] --key-store-alias-password [hiddenpass] --copy-to ../bilbonbizi.apk
cd ..
adb install ./bilbonbizi.apk
After this, the app is properly installed in the phone but is not being pushed to the watch.
Output logs
adb logcat
02-07 20:39:24.600 28861 7360 I ActivityUpsampling: AR upsampling state transition NORMAL_STATE --> NORMAL_STATE, activity: unknown
02-07 20:39:24.625 28861 7360 I Fit:LocationProvider: Location recording changed to : STOP_HIGH_FIDELITY_RECORDING.
02-07 20:39:25.962 3553 3553 D powerUI : accValue============37
02-07 20:39:25.962 3553 3553 D powerUI : mCputempVlaue============37
02-07 20:39:27.965 3553 3553 D powerUI : accValue============41
02-07 20:39:27.965 3553 3553 D powerUI : mCputempVlaue============41
02-07 20:39:28.825 5372 5527 D ClClient: Not sending keepalive. Current connection state=STOPPED
02-07 20:39:29.968 3553 3553 D powerUI : accValue============42
02-07 20:39:29.968 3553 3553 D powerUI : mCputempVlaue============42
02-07 20:39:30.506 7351 7351 I dex2oat : dex2oat took 8.052s (threads: 4) arena alloc=3MB java alloc=5MB native alloc=25MB free=3MB
02-07 20:39:30.964 997 1050 V BackupManagerService: restoreAtInstall pkg=com.berriart.bilbonbizi token=18 restoreSet=35825bc48d1581dc
02-07 20:39:30.966 997 3469 D BackupManagerService: MSG_RUN_RESTORE observer=null
02-07 20:39:30.975 4181 27142 I Backup : [GmsBackupTransport] New restore session, 2 apps
02-07 20:39:31.127 4181 27142 W Conscrypt: Could not set socket write timeout: null
02-07 20:39:31.198 4181 27142 W Conscrypt: Could not set socket write timeout: null
02-07 20:39:31.399 4181 27142 I GmsBackupTransport: Http Response Code : 200
02-07 20:39:31.411 4181 11827 I Backup : [GmsBackupTransport] Current restore package : PackageInfo{ebff3de #pm#}
02-07 20:39:31.411 4181 11827 I Backup : [GmsBackupTransport] A key/value pairs restore
02-07 20:39:31.412 997 3469 D BackupManagerService: initiateOneRestore packageName=#pm#
02-07 20:39:31.446 997 3469 V BackupManagerService: No more packages; finishing restore
02-07 20:39:31.450 4181 6449 I Backup : [GmsBackupTransport] restore finished
02-07 20:39:31.453 997 3469 I BackupRestoreController: restoreFinished for 0
02-07 20:39:31.453 997 3469 I BackupManagerService: Restore complete.
02-07 20:39:31.455 997 1050 W Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
02-07 20:39:31.456 997 1050 I art : Starting a blocking GC Explicit
02-07 20:39:31.687 997 1050 I art : Explicit concurrent mark sweep GC freed 192257(10MB) AllocSpace objects, 10(2MB) LOS objects, 33% free, 25MB/37MB, paused 2.673ms total 231.207ms
02-07 20:39:31.696 4764 4764 D BluetoothMapAppObserver: onReceive
02-07 20:39:31.696 4764 4764 D BluetoothMapAppObserver: The installed package is: com.berriart.bilbonbizi
02-07 20:39:31.700 4764 4764 D BluetoothMapAppObserver: Found 0 application(s) with intent android.bluetooth.action.BLUETOOTH_MAP_PROVIDER
02-07 20:39:31.703 4764 4764 D BluetoothMapAppObserver: Found 0 application(s) with intent android.bluetooth.action.BLUETOOTH_MAP_IM_PROVIDER
02-07 20:39:31.706 7337 7337 I art : System.exit called, status: 0
02-07 20:39:31.706 7337 7337 I AndroidRuntime: VM exiting with result code 0.
02-07 20:39:31.719 997 7064 W ActivityManager: Permission Denial: Accessing service ComponentInfo{com.google.android.music/com.google.android.music.dial.DialMediaRouteProviderService} from pid=6893, uid=1008$
that is not exported from uid 10065
02-07 20:39:31.722 7208 7364 D Documents: Update found 8 roots in 14ms
02-07 20:39:31.730 997 4095 W ActivityManager: Permission Denial: Accessing service ComponentInfo{com.google.android.music/com.google.android.music.dial.DialMediaRouteProviderService} from pid=12711, uid=1002
7 that is not exported from uid 10065
02-07 20:39:31.730 997 3363 I InputReader: Reconfiguring input devices. changes=0x00000010
02-07 20:39:31.802 7117 7117 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1221 android.content.ContextWrapper.startService:581 android.co
ntent.ContextWrapper.startService:581 com.bq.gallerybq.app.PackagesMonitor.onReceive:40 android.app.ActivityThread.handleReceiver:2725
02-07 20:39:31.823 4108 4108 D CarrierServiceBindHelper: Receive action: android.intent.action.PACKAGE_ADDED
02-07 20:39:31.824 4108 4108 D CarrierServiceBindHelper: mHandler: 3
02-07 20:39:31.824 4108 4108 D CarrierConfigLoader: mHandler: 9 phoneId: 0
02-07 20:39:31.838 997 7064 I ActivityManager: Start proc 7371:com.google.android.partnersetup/u0a12 for broadcast com.google.android.partnersetup/.RlzPingBroadcastReceiver
02-07 20:39:31.891 7371 7371 W System : ClassLoader referenced unknown path: /system/priv-app/GooglePartnerSetup/lib/arm
02-07 20:39:31.970 3553 3553 D powerUI : accValue============39
02-07 20:39:31.970 3553 3553 D powerUI : mCputempVlaue============39
02-07 20:39:31.980 9247 9247 I Finsky : [1] com.google.android.finsky.wear.WearSupportService.a(307): Wear auto install disabled for package com.berriart.bilbonbizi
02-07 20:39:31.992 997 3623 I ActivityManager: Killing 6845:com.pushbullet.android/u0a118 (adj 15): empty #17
02-07 20:39:32.072 997 7067 D ActivityManager: cleanUpApplicationRecord -- 6845
02-07 20:39:32.116 9247 9247 I Finsky : [1] com.google.android.finsky.utils.PermissionPolicies$PermissionPolicyService.onStartCommand(115): post-install permissions check for com.berriart.bilbonbizi
02-07 20:39:32.117 3947 7369 I WearablePkgInstaller: Setting DataItem to install wearable apps for com.berriart.bilbonbizi
02-07 20:39:32.155 9247 9247 I Finsky : [1] com.google.android.finsky.utils.bd.run(2300): Package state data is missing for com.berriart.bilbonbizi
02-07 20:39:32.303 5372 5372 V ApplicationReceiver:onReceive: 2017-02-07 19:39:32-03f1a6a6-fd89-4d04-98ad-0967d0ad6a4f-Application install message is received ver:1.2.2
02-07 20:39:32.304 5372 5372 V ApplicationReceiver:onReceive: 2017-02-07 19:39:32-03f1a6a6-fd89-4d04-98ad-0967d0ad6a4f-ApplicationReceiver detectes the installation of package:com.berriart.bilbonbizi ver:1.2.2
02-07 20:39:32.351 6446 7009 I Icing : Usage reports 0 indexed 0 rejected 0 imm upload false
02-07 20:39:32.361 487 487 I MSM-irqbalance: Decided to move IRQ177 from CPU4 to CPU6
02-07 20:39:32.367 6446 7009 I Icing : Usage reports 0 indexed 0 rejected 0 imm upload false
02-07 20:39:32.375 6446 7401 W IcingInternalCorpora: getNumBytesRead when not calculated.
02-07 20:39:32.503 9247 9247 I Finsky : [1] com.google.android.finsky.wear.bc.onPostExecute(2601): Writing installed apps for account [9oegQYjV2A_lG13uYgoCCNs4Sr8]
02-07 20:39:32.714 4764 5061 D bt_btm_pm: btm_pm_snd_md_req switching from SNIFF to ACTIVE.
02-07 20:39:32.747 3947 4409 V WearableLS: bindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:32.749 3947 4409 V WearableLS: unbindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:32.795 3947 4409 V WearableLS: bindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:32.798 3947 4409 V WearableLS: unbindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:32.994 4764 5061 D bt_btm_pm: btm_pm_proc_mode_change switched from UNKNOWN to ACTIVE.
02-07 20:39:33.106 3947 7369 I WearablePkgInstaller: Setting DataItem to install wearable apps for com.berriart.bilbonbizi
02-07 20:39:33.148 3947 4409 V WearableLS: bindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:33.151 3947 4409 V WearableLS: unbindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:33.200 3947 4409 V WearableLS: bindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:33.203 3947 4409 V WearableLS: unbindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:33.270 9247 9639 I PlayCommon: [1735] com.google.android.play.a.g.e(909): Preparing logs for uploading
02-07 20:39:33.270 9247 9639 I PlayCommon: [1735] com.google.android.play.a.g.e(911): No file ready to send
02-07 20:39:33.372 6446 6714 I Icing : Indexing FDFCB9FA2CA9FD93DE9DD0B9F5797CCEABC83AD6 from com.google.android.gms
02-07 20:39:33.449 3947 4409 V WearableLS: bindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:33.451 3947 4409 V WearableLS: unbindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:33.509 6446 6714 I Icing : Indexing done FDFCB9FA2CA9FD93DE9DD0B9F5797CCEABC83AD6
02-07 20:39:33.974 3553 3553 D powerUI : accValue============36
02-07 20:39:33.974 3553 3553 D powerUI : mCputempVlaue============36
02-07 20:39:35.978 3553 3553 D powerUI : accValue============35
02-07 20:39:35.978 3553 3553 D powerUI : mCputempVlaue============35
02-07 20:39:37.360 487 487 I MSM-irqbalance: Decided to move IRQ130 from CPU4 to CPU6
02-07 20:39:37.982 3553 3553 D powerUI : accValue============35
02-07 20:39:37.982 3553 3553 D powerUI : mCputempVlaue============35
02-07 20:39:38.455 3947 4409 V WearableLS: bindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
02-07 20:39:38.457 3947 4409 V WearableLS: unbindService: com.google.android.wearable.app/com.google.android.clockwork.companion.DispatchingWearableListenerService
I have pasted a long log in order to provide as much info as possible, but probably the most relevant logs are: (picked from above)
BluetoothMapAppObserver: The installed package is: com.berriart.bilbonbizi
CarrierServiceBindHelper: Receive action: android.intent.action.PACKAGE_ADDED
Finsky : [1] com.google.android.finsky.wear.WearSupportService.a(307): Wear auto install disabled for package com.berriart.bilbonbizi
Finsky : [1] com.google.android.finsky.utils.PermissionPolicies$PermissionPolicyService.onStartCommand(115): post-install permissions check for com.berriart.bilbonbizi
WearablePkgInstaller: Setting DataItem to install wearable apps for com.berriart.bilbonbizi
Finsky : [1] com.google.android.finsky.utils.bd.run(2300): Package state data is missing for com.berriart.bilbonbizi
ApplicationReceiver:onReceive: 2017-02-07 19:39:32-03f1a6a6-fd89-4d04-98ad-0967d0ad6a4f-Application install message is received ver:1.2.2
ApplicationReceiver:onReceive: 2017-02-07 19:39:32-03f1a6a6-fd89-4d04-98ad-0967d0ad6a4f-ApplicationReceiver detectes the installation of package:com.berriart.bilbonbizi ver:1.2.$
WearablePkgInstaller: Setting DataItem to install wearable apps for com.berriart.bilbonbizi
It's being extremely difficult for me to find information and understand the following log line:
Wear auto install disabled for package com.berriart.bilbonbizi
And also it is really strange to find the following line taking into account that I didn't change any version number and the one written in the manifest is 1.0:
the installation of package:com.berriart.bilbonbizi ver:1.2.$
Devices Information
PC
tns --version
# 2.5.0
cat /etc/lsb-release
# DISTRIB_ID=Ubuntu
# DISTRIB_RELEASE=16.10
# DISTRIB_CODENAME=yakkety
# DISTRIB_DESCRIPTION="Ubuntu 16.10"
tns-core-modules: "2.5.0"
tns-android: "2.5.0"
Phone
BQ Aquaris M5 (Android 6.0.1)
SmartWatch
Sony Smartwatch 3 (Compilation Number M1D64T)
Question
As I said, when the final APK is built and installed on a phone the wearable app is not being pushed to the connected watch. Is there anything wrong in the code/steps described above?
Let me know if I can help you by providing more information.
it could be useful to see the build.gradle files of your modules (both phone and weareable ones).
Also, you did not specify if you are trying to build an Android Wear App for Android Wear 2.0. I suppose you only need the Android Wear 1.x weareable app, since those are the only one that can be installed automatically over the air when installing the app on the handset.
In order for it to work correctly, your build.gradle file of the handset module should contains these dependencies:
dependencies {
...
compile 'com.google.android.gms:play-services-wearable:10.0.1'
compile 'com.android.support:support-compat:25.1.0'
wearApp project(':wearable')
...
}
Doing this you should normally just build and sign the handset apk

AVC denied warning leads to crash in android app

I have an app which is crashing from time to time and the only reason for the crash I can thing of, has to be the following LogCat content (yep, two times the same line):
07-19 18:16:16.636 W/the.app: type=1400 audit(0.0:4418): avc: denied { read } for comm=4173796E635461736B202331 name="mem" dev="debugfs" ino=81636 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debugfs:s0 tclass=file permissive=0
07-19 18:16:16.636 W/the.app: type=1400 audit(0.0:4419): avc: denied { read } for comm=4173796E635461736B202331 name="mem" dev="debugfs" ino=81636 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debugfs:s0 tclass=file permissive=0
Followed by "Force finishing activity". The biggest "surprise" here is, that it is sometimes working totally fine, but more often not. I have no idea what I can do with those messages.
Device: Zuk Z2 Pro (rooted)
OS: Android 6.0.1 (ZUI 2.0)

Categories

Resources