How to enable logcat output on Huawei MediaPad M3 - android

The MediaPad M3 does not log anything related to the app I am developing (compared to other Android devices). I understand that the log level usually can be set on Huawei devices via a hidden menu.
I came across these instructions many times while searching for the solution: https://gist.github.com/Shallong11/8403487
However, this is a tabled and it doesn't have GSM support and a Dialer / Phone application. So I fail at step one: dial ##2846579##.
Update #1: I've tried everything listed here: https://android.stackexchange.com/questions/59259/typing-dialer-secret-codes-in-devices-other-than-phones
Nothing works. The only reaction I've gotten: startActivity call with Intent.ACTION_DIAL is handled by Contacts app. Quite strange that there's a Contacts app but no Dialer...
It's probably meaningful to add that debug logs are displayed but stack traces of app crashes are not.
Update #2: I've also tried with some of these secret codes; nothing works: http://mobilespecs.net/phone/codes/Huawei/Huawei_MediaPad_M2.html

Because there is no dialer on the tablet, open calculator in landscape mode and enter
"()()2846579()()=" and the hidden menu should appear.
Here's a video demonstration.
Also please note that you'd need to restart the device afterwards in order for the changes to be applied.

Related

Some Samsung phones with Android 6 or higher don't have android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS

My app needs to allow users to disable doze mode for my app, so for that the app needs to open android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS but I get android.content.ActivityNotFoundException when trying to open that intent on some Samsung phones like the Galaxy A5.
Is there an equivalent on those phones? What about other phones?
Thanks.
Edit: I just want to be clear, I'm trying to find what the actual setting screen is on Samsung Phones like the A5, not just how to open settings. I need to direct the users to the right location.
Edit: To clarify further, we have no found the setting on that Samsung phone to make isIgnoringBatteryOptimizations() return true. That is my main question, what setting needs to change on that phone for that to become true.
The Samsung Galaxy A5 ran on three OSs:
Android 6.0.1, Android 7.0, Android 8.0.0 (GFX Bench)
The android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS activity was added in API 23. It was not removed afterwards. For some reason, this bug was never addressed by Samsung. The only solution is to bring the user to the system settings screen. See the following solution:
https://github.com/kontalk/androidclient/commit/be78119687940545d3613ae0d4280f4068125f6a
EDIT
After misunderstanding the question and with the clarification of the OP, I've added a potential solution to address which power setting needs to be accessed.
If you haven't already, make sure you are using android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS. Be sure that you add REQUEST_IGNORE_BATTERY_OPTIMIZATIONS in your manifest prior to using this activity.
Activity Action: Ask the user to allow an app to ignore battery optimizations (that is, put them on the whitelist of apps shown by ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS). For an app to use this, it also must hold the Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission.
This should bring the user to the exact option necessary.
If you have one of these phones (maybe virtual from some online services) you can run the adb command to find the running activities, this way you can check the intent and maybe you are allowed to call it:
adb shell dumpsys activity activities

How to set physical button to run app in android custom rom

I've got new mobile from ebay, Blackview bv6000, which has 3 special physical buttons
Camera
Sos
Ptt
Then i need to assign those buttons to run my app and some functions
I got stock rom from Blackview forum, after i extract system.img file and found
\usr\keylayout\Generic.kl
which contains list of key function that i need
key 212 CAMERA
...
#[AGOLD][2015.04.08]Fengjun merge
key 249 FUNC1
key 250 FUNC2
#[AGOLD]End
The question is how can i assign that key to run my app or function in my app?
Edit
More info:
I want to catch button event in home screen or in other app or even the screen is off
Look into KeyEvent which is shown in an functioning example in this answer. For the specific keys, check out https://developer.android.com/reference/android/view/KeyEvent.html
For example, KEYCODE_CAMERA for the camera button.
In my company we have been searching for this for a while and finally I have an answer.
We have recently contacted with the BV6000 main provider and they told me that those buttons can only be overrided by customizing the hardware specifically for your app and that they require a 500+ phones commercial order to start the procediment of customizing something.
They won't move a finger neither give any documentation for less than that :-/

Is android:excludeFromRecents broken for the first app that is launched on the device on Android L?

Is seems like the current way to exclude apps from the recent apps-lists in android L is broken. Our app is using android:excludeFromRecents and it works just fine. Unless our app is the FIRST app to start when the device reboots.
This is how it looks when our app is exited as the first app on the device:
And here is how it looks if we first start the camera (or any other app), then our app and exit both:
Simply put: If an app with android:excludeFromRecents is started as the first app on the device, the directive android:excludeFromRecents isn't working. If another app has been started before the android:excludeFromRecents-app, it works as expected.
Is this a really weird edge-case bug or am i'm missing something very obvious here?
We build a very privacy cautious web browser (http://inbrowserapp.com), so we cannot have any screenshots from the app showing once the app is closed. But this should also affect banking-apps, password-managers etc since sensitive information will be screenshotted if the app is the first to start after a reboot.
Maybe we can go about the route and hide the sensitive information with a blank view when the user is exiting on Android L. But its seems like something is buggy here?
I'm happy to say that this is fixed for Android 5.1. Just confirmed it on a device running 5.1.
So the correct solution, for us anyways, is to deny screenshots with getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); for Lollipop with SDK version 21, anything below or above that should be fine.
You can at least prevent the screenshot in recents by setting this flag:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
But it's still a bug that never should have made it to release..

App removed from whitelist in Stamina mode (Sony devices)

Some Sony devices have a Stamina mode to increase the standby time of the device. It turns off
data traffic and prevents background activities from waking up the system. Apps can be white-listed though.
Some users have reported that my app is removed from the white list after each reboot which is bad because it's an email client that should be able to wake up the system when new mails are pushed.
Does anyone have more in-depth information about the Stamina mode and why it would remove apps from the white list?
My online research didn't bring up anything useful on this.
There are a couple of articles about the mode but they don't go any further than explaining what the mode does and how it can be configured. The best I could come up with was this: http://commonsware.com/blog/2013/03/08/warning-xperia-z-stamina-alarmmanager.html but that doesn't answer my question either.
Well, I can tell you that on an SONY Xperia Z, with the latest firmware, I cannot reproduce the problem. Apps added to the STAMINA whitelist survive a reboot.
Beyond that, I suspect that you will need to contact SONY.
After purchasing a Sony Xperia Z and doing some extensive tests I finally found the offending "component" ... the package name!
I created the most basic test app with one Activity (doing nothing), one app icon, one string for the app name and the manifest file. I installed the app with two different package names (from two of my apps):
package="com.onegravity.sudoku4ever.free"
package="com.onegravity.sudoku.sudoku10kfree"
I then added both apps to the white list, rebooted the device and the second app disappeared from the white list. The app is also removed from the white list if it's the only one installed (If I install only the test app with package name com.onegravity.sudoku.sudoku10kfree).
I didn't run any further tests to find out which package names "make it" because the package name is the one thing I can't change in my apps.
Obviously there's a major bug in the stamina mode / white list component and only Sony can fix it ;-(

LogCat goes crazy (Eclipse)

I'm noticing a strange behaviour when i plug in any android device to my computer.
It starts showing some messages in the LogCat in Eclipse as soon as i plug it in. Same thing with my HTC and ASUS tablet.
This has never happened before and I dont remember doing anything out of ordinary when I developed my app yesterday.
Any1 has an idea how to stop this ?
Thanks in advance
You can add filters to the logcat so that you only show relevant information.
From my experience it's perfectly normal for the logcat to start displaying messages as soon as you plug in a device. At the least it means it's working! ;)
However, once you start building and running your application and picking up errors the specific filter for your application will start displaying which will only show logs pertaining to your app.
It's set by default to switch to your app once an error displays, but you can change that default by going to Preferences > Android > LogCat and changing "Show logcat view..." from "Error" to "Verbose" or whatever works. That way it will switch to showing your application's logs faster. Beyond that, you can do further specific filters.
Hope that helps XD
This can't be stopped as such as the log cat in eclipse will retrieve anything where logging is being done of some sort whether it is an app, or android itself.
You can filter it, I think at the top of the log cat window there is a text field to only show log messages that contain a certain string and If I remember correctly there are also buttons to the right to only show error messages or warning or both etc.
I had the same problem with my Nexus 5. Eclipse wouldn't recognize the device, so I messed around with the device window a bit and then the log cat started to go crazy.
After several reboots, I un-checked the USB debugging option in the phone's Developer settings and re-checked it.
Problem solved.
I think something in the Device window changed when I performed this action, but I'm not certain.

Categories

Resources