#StackBounty: #java #android #debugging #adb #apktool error: No resource identifier found for attribute 'requestLegacyExternalStora…

Bounty: 50

I have decompile APK using ‘apktool d demoapp.apk’ then compiling apk using ‘apktool b demoapp.apk’ but at compile time it throws error

brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1):

Here No resource identifier found for attribute ‘preserveLegacyExternalStorage’ in package ‘android’ and same for ‘requestLegacyExternalStorage’ as well.


Get this bounty!!!

#StackBounty: #adb #notifications #usb-debugging #shell Interact with notification action from ADB Shell

Bounty: 250

I have an Android(7) phone and a Linux pc. By enabling USB debugging and using the terminal of my pc, I am able to read the notifications of my phone using the command: adb shell dumpsys notification --noredact

Now, there are some notifications in android in which we can interact with the app directly from the notification. For example, in a Whatsapp notification, there are usually two buttons: Reply & Mark as read. In YouTube, there are options like Play, Turn off, Watch later. In the output of the above command, these options are visible in the following form:

actions={
        [0] "Reply" -> PendingIntent{6becf48: PendingIntentRecord{87b8050 com.whatsapp startService (whitelist: +30s0ms)}}
        [1] "Mark as read" -> PendingIntent{c1661e1: PendingIntentRecord{b8e3249 com.whatsapp startService (whitelist: +30s0ms)}}
      }

I have two questions:

  1. Can we interact with these options from adb shell? For example, is there any command like adb shell <SOME COMMAND> 'Message to be sent in whatsapp with reply option' which will send the text as a reply in whatsapp without opening the app?
  2. Is it possible to swipe the notifications using any adb command? (Not the adb shell input swipe x0 y0 x1 y1, it requires to unlock the phone each time)

Thank you in advance!

Edit:

Here is what I found that may be relevant to this question.

I think that I have to somehow launch the specific intent linked to the mentioned PendingIntent id (in this case 6becf48 or 87b8050)

Using tthe command adb shell dumpsys activity intents > output.txt and then searching for 87b8050 in output.txt, I found the name of the intent. It was as follows:

  * PendingIntentRecord{87b8050 com.whatsapp startService (whitelist: +30s0ms)}
    uid=10104 packageName=com.whatsapp type=startService flags=0x0
    requestIntent=act=com.whatsapp.intent.action.DIRECT_REPLY_FROM_MESSAGE dat=content://com.whatsapp.provider.contact/contacts/2256 cmp=com.whatsapp/.notification.DirectReplyService (has extras)
    whitelistDuration=+30s0ms

Now I think that it may be possible to launch the intent com.whatsapp.intent.action.DIRECT_REPLY_FROM_MESSAGE using adb shell am command, and passing the intent id and message as some parameters.

(Just like we can launch Whatsapp from adb with am command, it should be possible to launch the pendingIntent also.)


Get this bounty!!!

#StackBounty: #adb #camera Making the front camera the main one, or disabling the main (back) camera

Bounty: 50

My device’s rear (main) camera is broken.

WhatsApp Web pairing uses the main camera in order to scan a QR code and can’t be switched to the front (selfie) one.

Is there any ADB command that can switch the roles of Main and Front cameras? this way, the front will be activated by WhatsApp and I’ll be able to scan the QR code.

Alternatively is there an ADB command that disables the main camera altogether? since that might also do the trick.

I’m with Android 10 with latest security updates (Android One).


Get this bounty!!!

#StackBounty: #wi-fi #adb #mac-address Set fixed BSSID in LineageOS16 / Android

Bounty: 50

I’m searching for a way to set the BSSID my OnePlus One (running LineageOS 16) is connecting to. I started adb shell as root and tried to change the BSSID in /data/misc/wifi/WifiConfigStore.xml, but when restarting the WiFi connection, the *.xml file gets set to default.

Can someone tell me which file needs to be edited that the MAC Address of the BSSID may get written to the *.xml file, or in which format the change needs to be made so that it won’t get set to default?

EDIT:

I found a configuration documentation which tells about editing a Public String, but I don’t know what needs to be edited and how. https://developer.android.com/reference/android/net/wifi/WifiConfiguration#BSSID

Thanks in advance,


Get this bounty!!!

#StackBounty: #google-play-store #adb #security #installation #apk How to block app silent installation

Bounty: 100

Recently I noticed I have opera browser installed. I definitely did not install it because I was sleeping at that time. I checked installation time and revealed it was the day before yesterday

enter image description here

Checking installation source like this outputs android:

adb shell dumpsys package com.opera.browser | grep -e "installerPackageName"

so I don’t know whether it was through Play Store or through APK.

Can I found out who have done this and how can I prevent future intrusions?

P.S. I have MIUI 11.0.3 Global device

UPDATE:

INSTALL_PACKAGES permission

apps

  • com.miui.msa.global
  • com.android.vending
  • com.miui.cloudbackup
  • com.google.android.packageinstaller
  • com.xiaomi.mipicks
  • com.android.managedprovisioning
  • com.facebook.system
  • com.miui.analytics
  • com.xiaomi.discover

users

  • android.uid.backup
  • android.uid.shell

services

  • com.lbe.security.miui/com.lbe.security.service.SecurityService

REQUEST_INSTALL_PACKAGES permission

  • android
  • com.miui.msa.global
  • com.android.browser
  • com.miui.player
  • com.google.android.gm
  • com.google.android.apps.docs
  • com.android.chrome
  • com.xiaomi.midrop
  • com.miui.hybrid
  • com.miui.securityadd

users

  • android.uid.bluetooth


Get this bounty!!!

#StackBounty: #adb #backup #restore #android-emulator ADB backup and restore app data between device and emulator?

Bounty: 100

* = Edited on 03/25/2018

I have an application for which I’d like to transfer the app data from my physical device to an emulator on my PC. *The data consists of a single .sol file which is saved at:

datadatapackage.namefilesfile.sol  

I’m not proficient with ADB / Linux / Bash, so I’d appreciate any efforts spared to elaborate with more verbose guidance (I’m not afraid to read through essays, I’m afraid of the one-line answers). The device has to be kept stock (rootless). Here are the specs:

Device (Source):
Samsung SM-N950U Stock (T-MO)
Android 8.0
*Bootloader Version: N950USQS5CRL1
Emulator (Destination):
Runtime Environment: 6.0.6 Good
Device Model: Samsung Galaxy Note 8 Android 5.1.1 (US)

After quite a bit of digging around, I finally got ADB backup to work do something (after an OTA update, it kept producing a 1KB file with no error echoed back). I’m not 100% sure the backup is now fully functional, but it now produces a 17KB .ab file (I am using the -noapk argument, and the contents of the backup should decompress into a .sol file so it wouldn’t be a huge file or anything). Here’s the syntax I used:

adb -d backup com.example.example "-noapk -obb -shared" -f examplebackup.ab

When using ADB restore to the emulator, everything goes smoothly and no error message is produced (unlock dialogue prompt comes up so I know it’s going to the correct device). However, opening the application it acts like I’ve just opened it for the first time, so no save data was transferred over. For reference, this is the syntax I used:

adb -s 127.0.0.1:21513 restore examplebackup.ab

I know there are several similar threads, but none addressed this type of cross platform transfer that I saw, and none of the potential workarounds or solutions seemed to work (although one of them did help me figure out the 1KB backup issue). Hoping to get some help with this, and my apologies if this was addressed somewhere but I just couldn’t understand it.

Thanks in advance for any assistance!


*UPDATE

In the past weeks, I’ve pieced together more information from here and there, and I’ve decided to come back and update this post for any others who might be struggling with the same issue. At this time, I believe it will not be possible to accomplish my objective of retrieving my data, but it’s not necessarily true for others. Below, I’ll explain my attempts and the setbacks I encountered from a layman’s perspective, but if anyone more knowledgeable on the subject feels inclined to clarify anything I’m unaware of or misunderstood, it’d be greatly appreciated.

  • I have spoken with technicians at Google, Samsung, the mobile carrier, the community members from all of the above, and obviously here on Android Stack Exchange (with zero answers). All of the “official” sources where I was able to get a response from have told me it isn’t possible, and unexpectedly proceeded to push the blame onto the developer and/or each other.
  • From my understanding, in order for the ADB backup method to fully function as I want it to, I would either need root access, or the application needs to be debuggable. I have checked the app manifest and have seen that it isn’t (but backup is enabled, by the way).
    • Another method through ADB I had read was to invoke run-as, essentially “borrowing” the application’s identity and therefore inheriting its own permissions, and then pulling the data thereafter. Unfortunately, it seems this command has either been deprecated or broken since Marshmallow 6.0+ (I’m not sure if that’s universal to the OS or just Samsung, either way it doesn’t help my situation).
    • I also wasn’t sure whether a rootless BusyBox installation would make it possible to at least grant me access permissions to read the .sol file, if not copy the contents. I wasn’t able to completely comprehend the XDA thread contents, but from what I could discern from the comments it still wouldn’t have the required permissions to access datadata.. (there seems to be some mention of a potential workaround by installing BusyBox into the same directory(?) but there wasn’t any further explicit guidance or example that I could find).
  • I believe the device-to-device backup methods (such as Google Backup or Samsung Smart Switch) might possibly work, since they should have the proper permissions(?); however, as I can only restore onto a device with same or higher OS version among other factors, I have no way of verifying whether or not it works other than by deleting my local data and trying to restore it (obviously, I’d be shooting myself in the foot if it didn’t actually work).
    • As the Google Backup method states it needs to be restored onto a device of equivalent OS version or higher, one option I had thought of was restoring onto an emulator running Oreo 8.0, and from there enabling root to extract the data I needed. However, the only one I could find was the default provided through AVD from the Android SDK; an 8.0 emulator was available with Play services enabled and preloaded, but for whatever reason it shows the application is incompatible, so that was a dead-end.
    • Smart Switch does offer a backup “to external storage” option, but even though I have encryption disabled on both my device as well as the Smart Switch backup settings the backup still results in an .enc container, which I’ve not been able to find a way to decompress or extract from (see below for further on this).
  • Unfortunately, I was stupid enough to install the latest OTA update before checking, but there doesn’t seem to be a method for root at this time on the newer bootloader/firmware versions. So for the time being, I’m just stuck with no way to retrieve my own data.

Things I’d still like to find out:

  • I am inferring that invoking adb backup with the correct syntax and -noapk argument outputs a non-zero / -single kb file because it is properly backing up all the application-related data except what’s stored in datadata.. ? Or is the inclusion of the enabled backup flag in manifest supposed to make ADB backup work regardless of root? If the latter is true, what am I doing wrong?
  • I’m wondering if I can somehow create a virtual “external storage” in an emulator and use Smart Switch to restore the .enc file; the emulator I use does offer shared storage between VM and desktop, but they are not recognized in Smart Switch as mounted “external storage”, therefore leaving no way to point to the file). Otherwise, it’d be great to be able to directly access the .enc container somehow, I just don’t understand the point of letting the user choose unencrypted if it’s going to be encrypted anyway.
  • Although I have a (likely biased) feeling it shouldn’t have to come to this, I do have the means to contact the app’s developer. If I do go that route, what would be the more appropriate “means” to ask for in order to achieve the desired result? E.g., “can you please make your app debuggable?” vs “can you change the directory for this particular file to save in a non-system directory?”, etc.
  • I’m curious if there’s anything I can do via SetEdit (after elevating permissions as instructed) that might help me with this problem?


Get this bounty!!!