Messenger dark theme - Android Q&A, Help & Troubleshooting

Hi, Messenger Beta recently released a dark theme in development. I wanted to try it out but it didn't work.
This is what I get when I type in the code in adb shell:
Starting: Intent { cmp=34com.facebook.orca/com.facebook.abtest.gkprefs.GkSetting
sListActivity34 }
Error type 3
Error: Activity class {34com.facebook.orca/com.facebook.abtest.gkprefs.GkSetting
sListActivity34} does not exist.
My device is Redmi Note 4x (SD)

Related

[Q] Why is my onboot broadcastreceiver activty being killed

Im new to android development, so probably be making al the old mistakes.
I created an app it runs fine.
I added an broadcast receiver to do some actions on boot of the device
On boot i want to write some data to the SDcard so ill have to wait for it to become ready.
This is how i tried to do it.
psuedo code/code snipet
Code:
public class bootActivity extends BroadcastReceiver
{
@Override
public void onReceive(final Context context, final Intent intent)
{
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
{
new Thread()
{
@Override
public void run()
{
Log.d("TEST","starting");
for(;;)
{
Log.d("TEST","waitloop");
mc=Environment.getExternalStorageState();
try { Thread.sleep(10000); } catch(Exception ex) {}
if(mc.equals(Environment.MEDIA_MOUNTED)) break;
}
Log.d("TEST","do something");
// from here i write to sdcard...
}
}
}
}
In the emulator it works fine, with logcat i see
- D/TEST starting
- D/TEST waitloop (one or more)
- D/TEST do something
and the expected data gets writeen to the SDcard
On my real device i have problems, with logcat is see
- D/TEST starting
- D/TEST waitloop only once
- D/ActivityManager Kill hidden process PID: 333 with NAME test.test.test
Q1) Why is my broadcast activity being killed during boot
(and why does it work in the emulator and not on the real devices)
Q2) If case i'm doing everything wrong
What is the correct/better way to get the same result ?
First you'll want to confirm your process isn't crashing (look for a stack trace in your logcat view in Eclipse or on your phone using the alogcat app).
Besides that, Android is known to kill services if it runs low on memory. This is likely to happen during bootup when a lot of programs are run in sequence. By defining your service a certain way in your androidmanifest you can have the OS re-send intents if the service is killed. There's also a way to make your service a so called foreground service, which Android will think twice about killing. In either case, it's always safe to assume the OS may kill your service at any time so you'll have to pick up where you left off.
Hit up the reference on Services for more info.
- chris
Thanx for the heads up
I checked, my process is not crashing, (no stacktrace or any other errors in logcat)
I wil try to find out what to add to the manifest file
- to have the intents resend
- and how to get a higher dont kill me rank
Thanx
I redid my app doding the SDcard stuf in a service witch is reapplied/restarted if killed and start the service from the bootactivity.
It works fine

[Q] [ROOT] Embed 3th party activity in my Activity

Hi,
Please let me know if this is in the wrong sub-forum or not.
I'm developing an app, which should display the activity of another app (e.g. youtube) in its content.
I'm using the following code to get the activity of a 3th party application:
Code:
public View LoadActivity(String uniqueString) {
LocalActivityManager mgr = getLocalActivityManager();
Intent i = new Intent(this, SomeActivity.class);
Window w = mgr.startActivity("unique_per_activity_string", i);
View wd = w != null ? w.getDecorView() : null;
return wd;
}
However, due Security Restrictions, I'm receiving the following error:
java.lang.SecurityException: Requesting code from com.google.android.youtube (with uid 10065) to be run in process com.xxx.xxx.
Now i'm wondering if there is any way I can avoid this by rooting my device or doing some shell commands.
Regards,
XverhelstX

Qualcomm EngineerMode

so according to this article: https://arstechnica.com/gadgets/2017/11/oneplus-engineering-apk-exposes-backdoor-to-root-access/
"...The important part, though, is a "DiagEnabled" activity with a method called "escalatedUp." If this is set to "true," the app will allow root access over Android Debug Bridge, Android's command-line developer tools."
the article says the APK was also found in Asus and Xiaomi devices... I wonder if maybe it is also on the Moto Z?
Nope.
I ran:
Code:
adb shell am start com.android.engineeringmode/.EngineeringMode
and the output is:
Code:
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.android.engineeringmode/.EngineeringMode }
Error type 3
Error: Activity class {com.android.engineeringmode/com.android.engineeringmode.EngineeringMode} does not exist.

[APP][PACE] Step Notify - Fitbit-esque step notifications

This is a really simple app that notifies you at 10 to the hour (between 9:50 and 17:50 by default) if you have not completed 250 steps in that hour. The idea is a clone of that from Fitbit devices. It's designed for the Pace 1 (huanghe) but I think it will work on the Pace 2 (stratos), as the code should be the same (see the "code" section)
You can customise the alert with the following options:
- Choose times to show (any :50 in the day is available, default is 9:50 - 17:50)
- Choose days to show (default all enabled)
- Disable vibration (enabled by default)
Screenshots:
Download:
Version 1.0 (Also attached)
Installation:
Code:
adb install -r StepNotify-1.0.apk
Uninstallation:
Code:
adb uninstall com.kieronquinn.app.stepnotify
Code:
The full code for the app can be found at my GitHub
My initial plan for this app was to integrate the Huami layouts and code by disassembling and repairing them, but that was taking a lot of time so I simply threw together my own Wear-esque layouts with RecyclerViews and padding. It's not ideal but it works and is small.
In terms of step counting, turns out the step counter is accessible via Android APIs, nothing special. I found this by disassembling the Health app using JEB:
Code:
final SensorManager mManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
Sensor mStepSensor = mManager.getDefaultSensor(19);
SensorEventListener mListener = new SensorEventListener() {
public void onAccuracyChanged(Sensor arg1, int arg2) {
}
public void onSensorChanged(SensorEvent arg8) {
mManager.unregisterListener(this);
float[] v1 = arg8.values;
if (v1 != null && v1.length >= 1) {
int v0 = ((int) v1[0]);
if (v0 < 0) {
//Count is less than 0 (?)
} else {
//v0 is the step count
}
}
}
};
mManager.registerListener(mListener, mStepSensor, 0);
Now open sourced at https://github.com/KieronQuinn/AmazfitStepNotify
Tried the install this weekend. It installed OK and the settings seem to adjust OK but it doesn't seem to work. No alerts from the watch.
Default setting with vibration enabled.
-Thanks -Tsp
I think as a system application should be installed, eg. with Android Commander. It works like this. Maybe there is an ADB command as well, unfortunately I do not know.
Thanks
Enviado desde mi SM-G950F mediante Tapatalk

Interact with notification action from ADB shell

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:
Code:
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)}}
}
Click to expand...
Click to collapse
I have two questions:
Can we interact with these options from adb shell? For example, is there any command like
Code:
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?
Is it possible to swipe the notifications using any adb command? (Not the
Code:
adb shell input swipe x0 y0 x1 y1
, it requires to unlock the phone each time)
Some comments:
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 the command
Code:
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
Click to expand...
Click to collapse
Now I think that it may be possible to launch the intent
Code:
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.)
I'm searching for something similar.. Did you figure this out or still exploring?
bump !

Categories

Resources