Wednesday, February 27, 2019

Nexus 7 won't show up as a drive on Windows in MTP mode after update to Android 4.2


It used to work just fine then I upated to 4.2 and enabled developer options (one or the other must have broken it) and since then it has stopped working, it shows up as a camera device but if I change it to MTP it doesn't work.


I tried turning developer options off, I tried re-installing drivers and a few other things.


How do I make it work again like it was in 4.1 when it worked even when usb debugging was enabled? Now it won't work at all.




linux - Is it possible to reinstall stock Android on the Nexus 7


I'm new to rooting my phone, but I was thinking of trying out the KDE tablet interface on my Nexus 7. I'm probably not going to keep using this, since I like the huge app ecosystem on Android, so is it possible to reinstall stock Android on my tablet?





Is there any custom rom which can be installed on any android device



My question is, whether there are any custom rom's available which can be installed on any device or the rom's are just intended for a specific device. I always read that like custom rom for galaxy note 3, for s4 like that.. are there any roms available which can be installed on any device... if not, can any one explain why we need to design rom's for a specific model.



Answer




Each model has different hardware, which requires specific drivers. This is why each device has a separate ROM. This is different from desktop OSs because of the disk space constraints. If a ROM was made to support all devices, the drivers would eat all your available storage, and more.


Tuesday, February 26, 2019

Is there a way to run adb as host on android without root?


I have an android phone and an android tablet. Both not rooted. I want to use adb as host on the tablet and as client on the phone, using an USB-OTG adapter.


I downloaded connectbot as terminal emulator on the tablet. I also downloaded the ARM binary for adb onto the tablet. However I'm getting the following error when I try to execute the binary:


user@tablet:/storage/sdcard0/download $ ./adb-arm-binary.bin devices
/system/bin/sh: ./adb-arm-binary.bin: can't execute: Permission denied

Is there anyway to get ADB as a host to run on an android 4.4.2 tablet without root?


OR: Is there any way to root said tablet without a PC?


The whole reason I need this is because I need to access dumpsys logs from the phone but I do not have a PC or laptop. A way to get dumpsys logs directly on the phone without root would suffice too, but AFAIK dumpsys is impossible to access for non-system application.



Answer




Alright, I got it to work, here is what I did:



I was able to use kingroot to root the tablet.



I basically followed these instructions, however the files in the OP there are outdated and not downloadable anymore. So I used a file someone posted much later in that thread, this file seems outdated though, but I'm unsure about that and will open a new question about that.



  1. Downloaded the adb.bin file on the tablet (in /storage/sdcard0/Download)

  2. Downloaded Connectbot from f-droid and setup a local shell connection to the tablet

  3. Ran the following commands (everything after (including) the # is just a comment)



su # gain root priviledges
cd /storage/sdcard0/Download # change working directory to download folder
mount -o remount,rw /system # re-mount /system partition so we can write on it
cp adb.bin /system/bin/adb # copy it to bin folder so it's accessible as a command
chmod 755 /system/bin/adb # make it executable


  1. Rebooted tablet




This worked for me and got me an executable adb running. I still can't connect to my phone but since this is another issue I opened a new question.


offline - How to load public route into Google Maps?


Let's say there is a route:


https://maps.google.com/maps/ms?ie=UTF8&hl=pl&msa=0&msid=104314102588659350539.00043799567b09d5f132f&z=12


I have Google Maps (application) in my Android phone.



QUESTION: how can I load a route (as one above) so I could later turn it on (to see it over the map) and off (not to delete, just to make it disappear from the map)?


I am interested in downloading it (storing) for later off-line usage.



Answer



Is this the route you want to take offline in Google Maps app:
Google Maps Android App showing public route


How did I take it to Google Maps app? Well, I opened this question in Dolphin Browser and tapped the link you provided. It gave me Share via.. pop-up from which I chose Maps. Done!


To push links to Android device, you don't need to publish it on web. There are plenty of options available viz. AirDroid. You can use Gmail too. In Android device, just open that link in web browser.


If Share via.. pop-up doesn't appear with your web browser, it means that its not tightly integrated with Android. I'd recommend you to use Dolphin Browser because I have tested it.


To make it offline, just hit Options key & you'll find Make available offline option...
Make available offline option of Google Maps



To later use this map, just tap Layers icon on top bar (on bottom bar in ICS) & choose the route:
Layers icon of Google Maps app


Note: I've put screenshots from a Gingerbread device. My ICS device is currently not available. If you're running ICS or above, it'll be slightly different.


Monday, February 25, 2019

4.1 jelly bean - Factory reset: prestigio multipad 7.0 ultra plus tablet pc pmp 36 70b


How to factory reset prestigio multipad 7.0 ultra plus tablet pc pmp 36 70b? It boots to gmail sign in page, then it says wrong password, though it's not connected to the internet, it doesn't even let me connect. I need to reset it


Edit


usb debugging mode is not enabled and I am stuck, can't login like this, and the tablet,isn't booting to recovery



Answer



If you cannot access the main UI, but the system powers up, boot in to recovery.


Try and find out what your recovery keys are (e.g. it's usually vol+, vol- and power on Samsung phones) online or by reading your device's manual, then holding them as your device boots.


Once in recovery, use the volume keys to select an option and power to use that tool, unless your device has a d-pad or older Android style buttons (Menu, Home etcetera).




Also: You can use adb to force the device to reboot to recovery mode if it is enabled, like this, in a terminal or command prompt, with the device connected to a USB port on the computer:



$ path/to/adb reboot recovery on Linux/Mac OS X; and


C:\> path\to\adb.exe reboot recovery on Windows


replace path/to/adb or path\to\adb.exe with the location of adb found in the Android SDK platform-tools folder (the SDK can be downloaded from http://developer.android.com/sdk/index.html - choose SDK for an existing IDE)


Sunday, February 24, 2019

sync - Quickly send file from phone to PC via internet?



Is there a service/app that provide this functionality? I imagine the inversion of Awesome Drop.



Answer



A service like Dropbox should be able to do this for you. It'll sync the files up to the web, and then your PC (with Dropbox installed) should pull them down.


camera - How can I make my photos automatically geo-tagged?


Is there a way I can make photos taken by Camera be automatically and reliably geo-tagged, so that the location is recognised when I upload them to Flickr?



I have 'GPS' enabled in the camera, but it seems that if the GPS is not enabled or not 'ready', it isn't recorded (when I check the photo's details in Gallery, the location is 'Unknown').


Alternatively, is there a way I can geo-tag a photo after I've taken it? (edit: made this a separate question)


If it's relevant, my phone is a Samsung Galaxy S.



Answer



As long as you have GPS switched on on your phone (on a Galaxy S the easiest way to do this is from the buttons that appear when you pull the notification bar down from the top of the screen) and have GPS switched on in the camera, you should see the "satellite receiver" GPS icon appear and start flashing when you open the camera app. As long as you see this then your phone is trying to geo-tag your pictures.


Be aware that even in the best of conditions your phone can take 30 seconds or more to get a decent GPS position locked, so wait a bit after you open the camera app before you take the picture.


You can also speed up the GPS lock by making sure that you have the assisted GPS features switched on, see this previous question for details on how to switch those features on.


Saturday, February 23, 2019

2.2 froyo - Syncing tasks with exchange server


I've recently upgraded from a Windows Mobile 6.1 phone to a desire, and there is one feature that I miss and that's the ability to sync tasks with my exchange server. What are other people's, low cost solutions to this problem?



Answer



I've used Nitrodesk's TouchDown for that. It does the full Exchange experience. Not free, but not too horrible. I really liked it -- but ultimately uninstalled it as my current android phone is a little gimpy on processor power...



security - Is there a way for a user to tell if their Android device is encrypted or not?


There is a semi-relevant thread on SO https://stackoverflow.com/questions/12640708/check-if-android-filesystem-is-encrypted that explains how a developer would determine if full-disk encryption is enabled, but is there an easy way for a user to know? I tried encrypting (I'm on 4.4.2) and it seemed to fail at some point but did not throw an error, just dropped me back to the homescreen at a certain point.




tethering - receive/make calls on my pc via my android phone


is it possible to receive / make calls on my pc via my android phone. if so how? i have been searching the internet for a while now to find a solution for this. I have a rooted HTC Desire and i live in Denmark if that changes anything.




Do you know other Android keypad commands (dialer codes)?


There a lots of differents keypad commands in Android. Which one do you know ?



Some of them are listed here :


*#*#checkin#*#* Phones home to check for updates.


*#*#info#*#* - Enters a detailed phone information menu.


*#*#1472365#*#* : Access to the GPS config menu (useful for patching Galaxy S GPS failure)



Answer



This page has a good listing of keypad commands.


Here is the post:




*#*#4636#*#*


This code can be used to get some interesting information about your phone and battery. It shows following 4 menus on screen:



  • Phone information

  • Battery information

  • Battery history

  • Usage statistics




*#*#7780#*#*


This code can be used for a factory data reset. It'll remove following things:



  • Google account settings stored in your phone

  • System and application data and settings

  • Downloaded applications


It'll NOT remove:



  • Current system software and bundled applications

  • SD card files e.g. photos, music files, etc.



PS: Once you give this code, you get a prompt screen asking you to click on "Reset phone" button. So you get a chance to cancel your operation.




*2767*3855#

Think before you give this code. This code is used for factory format. It'll remove all files and settings including the internal memory storage. It'll also reinstall the phone firmware.


PS: Once you give this code, there is no way to cancel the operation unless you remove the battery from the phone. So think twice before giving this code.




*#*#34971539#*#*


This code is used to get information about phone camera. It shows following 4 menus:



  • Update camera firmware in image (Don't try this option)

  • Update camera firmware in SD card

  • Get camera firmware version

  • Get firmware update count


WARNING: Never use the first option otherwise your phone camera will stop working and you'll need to take your phone to service center to reinstall camera firmware.




*#*#7594#*#*


This one is my favorite one. This code can be used to change the "End Call / Power" button action in your phone. Be default, if you long press the button, it shows a screen asking you to select any option from Silent mode, Airplane mode and Power off.


You can change this action using this code. You can enable direct power off on this button so you don't need to waste your time in selecting the option.




*#*#273283*255*663282*#*#*

This code opens a File copy screen where you can backup your media files e.g. Images, Sound, Video and Voice memo.




*#*#197328640#*#*


This code can be used to enter into Service mode. You can run various tests and change settings in the service mode.




WLAN, GPS and Bluetooth Test Codes:


*#*#232339#*#* OR *#*#526#*#* OR *#*#528#*#* - WLAN test (Use "Menu" button to start various tests)


*#*#232338#*#* - Shows WiFi MAC address


*#*#1472365#*#* - GPS test


*#*#1575#*#* - Another GPS test


*#*#232331#*#* - Bluetooth test


*#*#232337#*# - Shows Bluetooth device address





*#*#8255#*#*

This code can be used to launch GTalk Service Monitor.




Codes to get Firmware version information:


*#*#4986*2650468#*#* - PDA, Phone, H/W, RFCallDate


*#*#1234#*#* - PDA and Phone


*#*#1111#*#* - FTA SW Version


*#*#2222#*#* - FTA HW Version


*#*#44336#*#* - PDA, Phone, CSC, Build Time, Changelist number





Codes to launch various Factory Tests:


*#*#0283#*#* - Packet Loopback


*#*#0*#*#* - LCD test


*#*#0673#*#* OR *#*#0289#*#* - Melody test


*#*#0842#*#* - Device test (Vibration test and BackLight test)


*#*#2663#*#* - Touch screen version


*#*#2664#*#* - Touch screen test


*#*#0588#*#* - Proximity sensor test


*#*#3264#*#* - RAM version



What do "NAND", "ROM" and "to flash" mean?




Possible Duplicate:
What is the difference between: Rooting, Jailbreak, ROM, Mod, etc.?



I'd like to know the meaning of the following terms:



  • What does NAND mean?

  • What is a ROM? Is it a custom OS?


  • What does "to flash" refer to (as in, to flash a ROM)? Does it mean to copy?




Friday, February 22, 2019

Can I set up one android phone, create a backup and restore it in multiple phones?


Where I work, we give all salesmen an Android phone with a set of multiple preinstalled apps, a predefined contact list, some predefined settings and restricted permissions over the phone's configuration.


I am responsible for setting up all of these things before giving the phone to the user, and it is a very repetitive and long process (almost an hour). I am looking for a smart way for automating or shortening the process as the set-up is always the same except for certain account information:



  1. Set up the brand new phone with a unique gmail account we create for each salesmen. (THIS IS ONE OF THE STEPS THAT REQUIRE A UNIQUE ACCOUNT FOR EACH PHONE).

  2. Install all predefined apps.

  3. Set up all predefined apps.


  4. Restrict permissions (using an app).


I'm thinking that a viable way of doing this is to completely set up one phone manually and do a complete backup of the phone to a computer. Then, in the future the only thing that I would have to do is to "Restore" the brand new phone with the backup and change only the settings that differ from user to user (i.e the phone's gmail account, the play store's account, the Whatsapp phone number, etc...)


Is this possible and viable?


How could I do this (which app could I use)?


The only caveat I can anticipate is that the original phone would be set up with a particular gmail account, phone number, etc.. Will I have any problem changing this setting in the restored phones?


Thanks !




Thursday, February 21, 2019

notifications - How to turn off Vibration in Google Hangouts [ Version: 6.1.109448852]


It is really annoying that the mobile phone vibrates on every message arrives on google hangouts after update, how to disable it ? I mean for all messages I just don't need vibration, only sound notification is required.




file system - How to change random filesystem label on USB OTG?


I am without PC right now, but I need to Format USB Drive (to FAT32 or Ext4) with Samsung S8 (Android 9) and change label. But I can't find any app that can do this. I can format USB drive in Storage Menu, but without any options, it just gives it Random number name (I can see it in Total commander) and I think it's Ext4, but again no options. Is there any option to rename the Label?


I found they there is Aparted app (port of gparted) but it needs ROOT and also it gives random label.


I also tried to rename drive in Total commander, but it says it's ranamed, but in reality it has old label. Thanks for any help :).




keyboard - How do I type a tabulation character on an Xperia?



I imported my notes from my Palm Centro into Note Everything and the tab characters in my existing notes show up correctly.


But how do I type a tab character on my Xperia X10?



Answer



If you use the Swype keyboard, holding the space key gives you a tab. Smart Keyboard Pro also has tab, press ?123 twice for it.


Reference: http://androidforums.com/android-applications/151563-softkeyboard-tab-key.html


How to Backup and Restore Android OS without Rooting



I want to find a way to restore my phone in case the process of rooting my phone or dual booting a custom rom breaks it. However, most of the ones I've looked at require the phone to be rooted before installing. I know I can create a nandroid backup through system settings, but I don't know how to recover that without rooting my device, or if there are better options. I'm not terribly concerned for any personal data on my phone (I can backup my pictures pretty easily), but I mostly just want to be able reinstall Android OS or reset to factory default in case my device breaks. Thanks!

Edit: I am going to ask a new question (one different enough to justify not simply modifying this one) with the new info I learned from the possible duplicate.




charging - Exclude possibility of damage of Android device while chargin with another charger



Is it true, that if I have one Android tablet with mini-usb from Philips, one Android device with mini-usb from Sony, then if I connect Philips charger to Sony charger, then it is possibility for a device to blast or cause any damage?



I heard about a story, where woman connected charger of other manufacturer and during phone call device blasted. I don't know if it is a rumor, or this is truth? In the other hand, workmate says that solution is on a hardware level and devices detect voltage and solve this issue automatically.


Is it safe to charge with different manufacturer charger or not?



Answer



Workmate is correct: all USB chargers supply 5 V with current limited by the design of the charger. However, the device won't draw more current than it needs -- connect a 2 A capable device to a 500 mA charger, and it'll charge at 500 mA, but connect a 500 mA device to a 2 A charger, and it'll still only draw 500 mA.


Battery fires and explosions are caused by internal shorts and excessive current draw from the battery, not by charger mismatches (within USB voltage spec).


Wednesday, February 20, 2019

android sdk - What do I type in PATH variable for ADB server to start from CMD?


I am following a Wiki on how to install and set up Android SDK and I am stuck at a step where I am supposed to test if the ADB server works by using the command adb start-server. Is this command correct?


The Wiki can be found here: http://wiki.rootzwiki.com/Android_SDK


I have done what it says in step 5. But it doesn't seem to work. I get the standard message in CMD that the command is not an internal, external command or a program.




Add the following to the end of the Variable value field:


Windows XP: ;C:\Program Files\Android\android-sdk\tools\;C:\Program Files\Android\android-sdk\platform-tools\


Windows Vista and later: Replace YOURUSERNAME in the following lines with your Windows username


32-Bit: ;C:\Program Files\Android\android-sdk\tools\;C:\Program Files\Android\android-sdk\platform-tools\


64-Bit: ;C:\Users\YOURUSERNAME\AppData\Local\Android\android-sdk\tools\;C:\Users\YOURUSERNAME\AppData\Local\Android\android-sdk\platform-tools\


Click OK, OK, and OK to close the Advanced settings.



So what gives? The CMD prompt is at C:\Users\myusername when I run the command. Maybe I need to CD to the android-sdk folder first before running the command? But then what use is it to add the path in the PATH variable?...



Answer



I have solved my own problem. Those search paths are all messed up!



I checked the installation path and it's installed in C:\Program Files (x86)\Android even though I do have a 64-bit version of Windows. But nevertheless, this is the default installation location.


So I updated the PATH variable with following line.


C:\Program Files (x86)\Android\android-sdk\tools\;C:\Program Files (x86)\Android\android-sdk\platform-tools\


And now I can start ADB server from CMD regardless of where the prompt is at.


Android SDK ADB server in CMD screen


I have no clue why they are referring to AppData\Local\ folder in the guide for the 64-bit systems. That makes no sense at all. If anywhere, the installation location should be in "Program Files" folder for a 64-bit system. They actually put this in for the 32-bit systems... like I said, it's all messed up.


I should point out that adb.exe has been moved from C:\Program Files (x86)\Android\android-sdk\tools\ to the new location C:\Program Files (x86)\Android\android-sdk\platform-tools\. This has been done in later versions of Android SDK.


So if you are reading this in year 2013 then you can probably just get the latest SDK and use only this last search path. You don't need them both. At least not for ADB and Fastboot. If you're a developer then you maybe need to access tools from both directories, although if you're a dev then you probably won't need to read this at all.


How to edit a system variable


Here's a short how-to for the newbies. What you need is the Environment Variables dialog.




  1. Click Start (Orb) menu button.

  2. Right click on Computer icon.

  3. Click on Properties. This will bring up System window in Control Panel.

  4. Click on Advanced System Settings on the left. This will bring up the System Properties window with Advanced tab selected.

  5. Click on Environment Variables button on the bottom of the dialog. This brings up the Environment Variables dialog.

  6. In the System Variables section, scroll down till you see Path.

  7. Click on Path to select it, then the Edit button. This will bring up the Edit System Variable dialog.

  8. While the Variable value field is selected, press the End key on your keyboard to go to the right end of the line, or use the arrow keys to move the marker to the end.

  9. Type in ;C:\Program Files (x86)\Android\android-sdk\tools\;C:\Program Files (x86)\Android\android-sdk\platform-tools\ and click OK.


  10. Click OK again, then OK once more to save and exit out of the dialogs.


That's it! You can now start any Android SDK tool, e.g. ADB or Fastboot, regardless of what your current directory is in CMD. For good measure here's what the dialog looks like. This is where you edit the Path variable.


environment variables


2.2 froyo - Show the time an SMS was sent, not received


Scenario is as follows-



  • Switch flight mode on. Go into meeting/go to sleep.

  • Switch flight mode off. Receive a message.

  • Timestamp on the message is the time received.



With my old Nokia, under details it would show the time the message was actually sent. Is it possible to show this on Android?



Answer



There is an app called SMS Timestamper that appends the received time to incoming text messages. Worth mentioning for those not comfortable with fiddling with the OS's internals, or those unsure if it would work on their version of the firmware. I'm on JPO so I didn't want to chance it.


Tuesday, February 19, 2019

Difference between Super LCD screen of Nexus S and Super AMOLED screen of Samsung Galaxy S -- Which is better?



I was wondering has anyone of you experience the difference among super LCD screen of Nexus S, and Super AMOLED screen of Samsung Galaxy S? Which type of screen is better?



Answer



As Ryan has pointed out there isn't that much of a difference between Super AMOLED and Super LCD screens - chances are you will be hard pressed to see the colour difference unless you have two mobiles side by side (or at least the difference is small enough it shouldn't really be an issue)


From what I've read, where the two differ are:




  • Battery usage - AMOLED uses less power, thus longer use of the phone on one battery charge.




  • Screen glare (under the sun) - LCD screens I believe have less glare and are more 'readable' compared to the standard AMOLED. Supposedly the Super AMOLED has improved from the AMOLED and is more readable under the sun too.





edit: It seems like Super AMOLED has indeed improved compared to AMOLED. According to engadget, Super AMOLED is now similar to LCD - both are slightly more visible than AMOLED under the sun. Super AMOLED vs AMOLED vs LCD


Super AMOLED, AMOLED, LCD (screens left to right)


Atrocious battery life with Cyanogenmod 11 on Galaxy S4 mini



I love so many things about CM10, but the battery life is an absolute nightmare. I made a comparison against the stock firmware by leaving the phone unused for as long as I could. Results:


Stock: ~5.2 days standby to full discharge


CM10: ~1.7 days of standby to full discharge


Is there anything I can do about this, or is CM10 simply not supported properly on my device?




Made these screenshots on my S4 mini by leaving it unused for as long as I could. In the CM10 example it actually powered off due to low battery and I had to plug it in before it would even turn on again, so this is NOT due to any calibration; the battery was actually empty at the end of the test. But even if you take the final charge as 15%, the numbers are still atrocious.


enter image description here




security - Do permissions apply across users?



If I create a secondary user and install an app while using the phone as that user, will the permissions for that app carry over for the primary user?


For example, let's say I have a primary user, Foo, with a Google account foo@gmail.com. I then create the user Bar with the account bar@gmail.com. Whilst using the phone as Bar, I install an app with the "find accounts on the device" permission.


Will this allow the app to see the accounts I have registered with the primary account, i.e. foo@gmail.com? Will it even be able to find the primary user at all or are there hard boundaries between user "workspaces" (for lack of a better term), and as far as the app can see, there's only Bar and its registered accounts on the device?


I'm just generally concerned with apps finding out about my personal data, contacts, emails, etc, and would like to use a "dummy" account for any app I consider hostile in this regard. Would this work?


I have a Nexus 5X running Android 6.0.1.




wi fi - How can I sync photos to a network drive over wifi?


My current workflow is to snap pics on my Droid, plug it in via USB, and sync the pics. I'd like to just run a script to sync the DCIM folder with a shared network drive, if anyone knows of a way that I can do this?


I can connect to the share with a file explorer app, but copying the files is even more awkward that way than plugging in the USB. The tech is there, I'm just wondering if there's a simple one-touch solution.




Answer



Try Image Transfer.


Monday, February 18, 2019

external sd - "Couldn't move app. Not enough storage space." I have factory reset my phone, inserted & formated a new 64GB MicroSD Card


As my wife bought an Android Phone last year, she has been using an 8GB MicroSD card, recently she wanted to increase more storage space due to having more music and photograph files. As such, I bought a new SanDisk 64GB MicroSD card Class10.



I have successfully formatted the 64GB MicroSD card using the phone's Format function and copied all her photos and music files into the card, I can view all the photos and play the mp3 with no problem. I can also successfully install Apps from PlayStore.


The problem comes when I start to move Apps from Internal to SD using the "Move to SD" function, which will prompt me "Couldn't move app. Not enough storage space."


So I thought there might be some residual apps data somewhere in the phone memory, hence, I factory reset the phone, reformat the 64GB MicroSD, and copy all the photos (folder name: Pictures) and mp3 (folder name: Music) back into the MicroSD. Although I have nearly 50GB of free space in the MicroSD, unfortunately, I am getting the same error again.


Details of the phone: Model number: e1901_v77gq2008 Android Version: 4.1.1 Build Number: e1901_v77_gq2008_20130131


Appreciate advice for any kind soul.




recovery mode - Install TWRP to only one slot or offline boot.img file, not both


I want to install TWRP on my phone that uses the A/B partition schema. The official TWRP installer ZIP by default installs to both boot_a and boot_b. This always breaks the system in the inactive slot because I install Magisk after flashing/OTA.


Can I install TWRP to only one slot, or an offline boot.img file (like Magisk Manager supports)?



Answer



So this way, I ended up creating a script on my own.


Lucky enough, installing TWRP to boot.img isn't hard at all. The install script in TWRP just replaces ramdisk.cpio with the one ramdisk-twrp.cpio provided in the ZIP.


The effective part of the script is as following, root is of course required.


ln -s /system/bin/linker64 /sbin/linker
cp /sbin/magiskboot

mkdir /data/local/tmp/twrp
cd /data/local/tmp/twrp
/sbin/magiskboot --unpack
cat > ramdisk.cpio
/sbin/magiskboot --repack boot.img
cp new-boot.img /sdcard/new-boot.img

Now the TWRP-installed new-boot.img is located at /sdcard/.


To install to a single slot, dd the boot image out and apply the same process as shown above and dd the new image back.


signal - What is *Cell standby* and how can I keep it from eating my battery?


Looking up my battery statistics, I almost always find Cell standby amongst the top consumers:


Battery Statistics


I never thought that "idle" would use so much energy. I saw that other people encounter similar problems:



Answers on those questions just give some raw ideas. I would like to know what exactly stands behind this, an whether there are ways to keep this "standby" from eating my battery?




Answer



Cell Signal


Some backgrounds as explained by ce4 on the question Does 'poor' reception deplete the battery quicker?:



The transceiver circuit is engineered with power saving in mind and will reduce sending power as much as possible if the reception is good. This also reduces the SAR value which is a measurement for exposure of the human body to radiation.


If the reception is bad sending signal strength has to be adjusted accordingly.



So that's what's really behind it: On poor reception, the device spends a lot of power to find a better/stronger signal (or any signal at all if lost). The following screenshot1 clearly shows those times, when you take a look at the bar titled Phone signal.


Battery Statistics details: Phone signal


"The greener the cleaner": A bright green means "good reception" (the screenshot shows this at the begin and end, that is here: morning and evening -- so at home I have good reception). Getting yellowish: "Moderate reception". This uses more energy: compare it with the graph on top of it (not in the screenshot -- but the same as in the first screenshot), and you see the bar is almost flat where the cell signal is good -- but falls faster where it's not. See the little red spots: "no reception". And phone will power-up like crazy to find a new cell tower...



How to find out where the dead spots are?


I already showed in my answer on Does 'poor' reception deplete the battery quicker? how one can find out about those "Dead Zones" and where they are:


Apps like No Signal Alert2 and OpenSignalMaps3 monitor the cell signal in background, and record those areas, so they can show you a map of where the dead zones were. OpenSignalMaps has the plus of showing you all cell towers in reach, pointing out which you are connected to. It also offers you a "compass" giving the direction to the strongest signal.


NoSignalAlert OpenSignalMaps


However, my answer on how to automatically deal with those dead zones was not that detailed. So I played around a bit with different solutions -- and here's what I've found out:


How to automatically deal with those dead zones to save energy?


Apps to automatize Airplane Mode


I've reached fairly good results with two apps: Autopilot4 and NoBars Battery Saver5. Both monitor the cell signal and, when it drops to far, switch to Airplane Mode for a predefined time. The user can define how long that would be. After that timeout, Airplane Mode gets disabled, and cell monitoring takes over.


Autopilot NoBars Battery Saver


In the second graph of my question, this shows up as "gaps" in the Phone Signal bar: As the cell radio was disabled during Airplane Mode, no colors are shown; the system didn't know anything about signal strength in this time frame. And with the cell radio turned off, it also didn't use additional power (more precisely, it didn't use any power for this radio then) -- which was exactly what was intended.



With Autopilot, the only annoying side-effect was: For each signal check, it flashed on the display for about a second. Aside from that, it gives more options to be configured by the user. However, as the results of both apps where absolutely comparable, those extra options seem not really necessary, while being nice to have. Another plus of Autopilot is the log provided to the user: This way you can see the exact times of mode switches.


Apps to handle data network


I've also tested ShutUpBatterySaver6, which aims to handle the data traffic. Dropping below a certain signal strength the user can define, it disables AutoSync, and below a second definable level switches off mobile internet altogether.


ShutUpBatterySaver ShutUpBatterySaver Notifications


It does, however, never activate (or deactivate) Airplane Mode, so the power used to get a (better) signal will still be the same. Though, with a bad signal data transfer uses more power than with a good signal, as e.g. package loss might be bigger. In the status bar I saw several times that it had AutoSync disabled7, so it seems to work. Not being a heavy data user (as the LBE stats in the same screenshot show), I could however not really tell how much help that brought: Compared to the two Airplane-Mode handling apps above, results in terms of gained battery duration were minimal (if any).


Combined solution


It would probably gain best results to join the two approaches. As I was not in the mood to check all possible combinations, I rather decided for the allmighty 6-letter-solution: T-A-S-K-E-R.


As most of you probably know, Tasker is the automation solution on Android. Guess it could even prepare coffee, if our devices had sensors to detect coffee and water. So I created some profiles for this great app -- and results were magnific!


Tasker Profiles Tasker Notifications


So basically it's 3 Profiles, communicating via a common variable:




  1. %SIGSTATE < 1: check if the signal falls below ~25%. If so, disable mobile data, set %SIGSTATE to 1.

  2. %SIGSTATE < 2: check if the signal falls below ~15%. If so, switch to airplane mode, set %SIGSTATE to 2.

  3. %SIGSTATE > 0: wait for 5 min, then disable airplane mode, activate mobile data, wait another 15 sec (for the signal to be restored), set %SIGSTATE to 0.


In my global Init profile (which gets executed when Tasker starts monitoring), %SIGSTATE is set to 0 (if it is unset). All 3 above profiles additionally set notifications, as the screenshot above shows9. Each state maintains one notification (which gets replaced when the same state re-occurs), the most up-to-date state is always on the bottom.


Results seemed even better than with the two airplane-mode handling apps above, but that might also be due to slightly different signal conditions. So it should at least be comparable. Using one of these 3 solutions, I came home after about 11 hours with about 20% more charge left then without applying any of them.


Having said this, I will end this answer showing the Tasker profiles I created, so you might use them with your Tasker installation:


Task "InitVars":




  • Variable -> Variable Set: %SIGSTATE = 0


Task "SigLow":



  • Net -> Mobile Data: Off

  • Variable -> Variable Set: %SIGSTATE = 1

  • Alert -> Notify Vibrate: Title "IzzySignal"; Text: "Signal Low; Mobile data disabled (Signal: %CELLSIG)"


Task "SigLost":




  • Variable -> Variable Set: %WLANSTATE = 0

  • Variable -> Variable Set: %WLANSTATE = 1 IF %Wifi ~ on

  • Net -> Airplane Mode: On

  • Net -> Wifi: On IF %WLANSTATE ~ 1

  • Variable -> Variable Set: %SIGSTATE = 2

  • Alert -> Notify Vibrate: Title "IzzySignal", Text: "Signal Lost; Entering Airplane Mode"


Task "SigReturn":



  • Task -> Wait: 5 Minutes


  • Net -> Airplane Mode: Off

  • Task -> Wait: 15 Seconds
    (give the device some time to find a new signal!)

  • Net -> Mobile Data: On IF %ROAM ~ Off
    (prevent bad surprise when returning from vacation abroad!)

  • Variable -> Variable Set: %SIGSTATE = 0

  • Alert -> Notify Vibrate: Title "IzzySignal", Text "Signal On; Airplane Mode disabled (Signal: %CELLSIG)"


Now for the profiles:


Profil SigLowCheck:




  • State -> Variable -> Variable Value: Name "%SIGSTATE", Op "Math: Less Than", Value "1"

  • State -> Phone -> Signal Strength: From 0 To 2

  • State -> Tasker -> Profile Active: "SigLost", [x] Invert
    (make sure to avoid a conflict: %SIGSTATE~0 && SignalStrength~1 would match both profiles condition)

  • Task: SigLow


Profil SigLostCheck:



  • State -> Variable -> Variable Value: Name "%SIGSTATE", Op "Math: Less Than", Value "2"


  • State -> Phone -> Signal Strength: From 0 To 1

  • Task: SigLost


Profile SigReturnCheck:



  • State -> Variable -> Variable Value: Name "%SIGSTATE", Op "Math: Greater Than", Value "0"

  • Task: SigReturn


Profile Init:




  • Event -> Tasker -> Monitor Start

  • Task: InitVars


Now that's just the basic concept, and can be extended with e.g. playing sounds, vibrating, flashing the display, and more. But the energy saving stuff is already in -- and does its job as described. Hope this can help you as well!


Another remark: At least with GSM (I cannot tell for CDMA), returning from Airplane Mode by default forces you to enter the SIM PIN. This can of course be switched off -- but in that case this additional protection is also gone when switching on the phone. No idea why this is not possible selectively, as it was with my pre-Android phones.


However, for some phones there's an alternative to some items in above tasks, which remove this limitation:



  • In SigLost, instead of Net -> Airplane Mode: On use Phone -> Radio: Off if your phone supports this (my Droid2/Milestone2 does not, unfortunately). If you can do this, the WiFi check becomes obsolete (and your Task cleaner).

  • The counter-reaction in SigReturn then also needs to be changed: Instead of Net -> Airplane Mode: Off, use Phone -> Radio: On.



Please let me know in the comments if this removes the limitation of the SIM PIN, as I cannot test it (my device does not support it, as described above).



The interesting thing I noticed was that there was multiple tasker icons appearing on the Status bar, which made things confusing as to regards the state that the tasker profiles was running as; I discovered that by setting the Title for the 'Notify Vibrate' in each of the above tasks to be the same, the net result is, one singular notification titled 'IzzyTasker' shows up, with the appropriate message used instead.


How to assign a hardware button to camera


I like the functionality of a hardware camera button. On my Lumia 920 I have a dedicated camera button that I can long-press at any time (in other apps or when the phone is locked) to open the camera app in 1-2 seconds.


I also have a Galaxy Note 1 (JB, rooted) without such hardware button. Is there a way to reconfigure one of the existing hardware buttons (e.g. long-press volume up) to always open the camera app even while the screen is locked?




internal storage - Can't move apps to SD card on Moto E


I recently purchased Moto E with Android 4.4.2 and soon after filled up the internal 4gb with apps.



I installed a 32gb SD card and nothing moves to it. Not even new apps. How can I set the default install location to be the SD card?




Sunday, February 17, 2019

Battery usage by certain applications


Can I find out how much battery takes running of certain application? The goal is to minimize using applications that take a lot of battery and maximize battery persistence before having to recharge.




Answer



If you go to Settings -> Battery(settings -> about phone -> battery in < ICS) . You'll see battery usage by everything running on your phone. If some certain application consumes very high battery, it will be listed there along with battery usage. You can then minimize use of such application.


enter image description here


LineageOS : upgrade nightly to unofficial


I have a lineageos 14.1 nightly signed (downloaded from the official website) installed on my phone. I built a 14.1 from the sources following the official wiki (tagged unofficial build). Currently I have this message saying to wipe the /data :



Can't install this package on top of incompatible data. Please try another package or run a factory reset



I don't understand why I should wipe my data, I thought that it was only when changing to a different ROM.


I want to know if there is a way to flash an unofficial without losing my data or why is that needed.



Answer



I found out that the release key is different, so a simple key migration solve it. The steps are explained on the Wiki.



wallpaper - Where is the background image saved?


Here's my situation:


I had an image from a website which I set as my background inside the browser. I am wondering now where I can find the image in the file system, because I can't find it online anymore. I am rooted.



Answer



I'm not sure if it's the same on older systems, but on ICS it appears to save directly to /data/data/com.android.settings/files/wallpaper. I set mine from the browser, pulled that file, then changed it to a .png extension and viola - it was the image I had set.


It also appears that this file simply gets overwritten when you change your wallpaper, so I don't see a way to recover one once it's changed unless you have a copy of the image somewhere else.


This also appears to be where it's saved on CyanogenMod 7, so it's possible that this is the "standard" location (certainly a good place to check, at least).


storage - Why my phone is always out of space recently, but I didn't install any new software




Possible Duplicate:

How can I free some disk space without deleting my apps?



I've installed such software as Shazam, Baidu Map, QQ, HiMarket, MeiTuan, UC Mobile, etc. At first everything is fine, but nowadays the phone always says "Low on space". What should I do?



Answer



It should be the applications occupying /data/ space as they are in use, mainly due to runtime files, cache, database, etc.


In order to verify this, you can execute the following:


adb shell
su -c "du /data" | sort -n

It should have a result like:



...

3792 /data/data/com.UCMobile
28399 /data/app
35647 /data/data
49374 /data/dalvik-cache
114865 /data/

And then you can check the directories from large to small, to see what's taking so much space.


adb - how to succesfully boot into bootloader/fastboot mode on alcatel 5049z smartphone


I am having issues( i am a "novice" when it comes to unlocking a30 android bootloader with a PC...) with booting into bootloader/fastboot mode on my stock rom--android 7--Alcatel a30(non rooted 5049z?)smartphone;i have tried the power button/volume button sequence method...no luck there,and have tried the adb method using:adb reboot bootloader/fastboot..again no luck!!!


I would like to know if any forum members know how i may unlock my a30 bootloader without(if possible?)rebooting to the aforementioned bootloader modes or is this phones bootloader unlockable without removing FRP(Factory Reset Protection)????


Thanks in advance for any helpful replies!




wi fi - What does a grey Wi-Fi icon mean?




Possible Duplicate:
What does it mean when the connectivity icons in the status bar go white/gray?



I've been searching google for this and I haven't been able to find a clear answer for this. Some say it's "insecure connection to Google servers", others say it's only blue when it's syncing etc.


The idea is that connecting to two different WiFi routers I get different icons. One shows blue, the other grey. The only difference between them is that the one that shows grey uses a certificate to authenticate, while the blue one uses a password, like any regular router.


So what's up?



Answer




It is the internet state indicator - grey means that your internet connection cannot reach Google's test server, and the blue icon means that you have a strong connection with Google's test server.


If it is grey, you may have issues accessing some internet services on your device, blue should work fine.


This is available on all types of data connections.


Saturday, February 16, 2019

4g - Enable LTE on Google Nexus 7 (2013) LTE tablet


I have a brand new Google Nexus 7 (2013) LTE tablet and failed or enabling LTE on it.


I had two cards (microSIM for Nexus and nanoSIM for iPad Mini) from the very same LTE-enabled local (Poland) carrier Aero2. Both are inserted to respectful devices, both devices are in the same place (same network coverage) and iPad Mini catches LTE signal (and its amazing speed) with no problems, while my Nexus falls back to HSPA+ at most, only sometimes uses 3G and never runs on LTE.


Is there any extra switch on this particular device or Android system (was on iPad Mini) to enable LTE?



EDIT: Of course, I followed step-by-step guide on this subject available at Google Nexus Help.



Answer



While unlikely, it's possible that the Nexus 7 doesn't support your local LTE network. It seems like Aero2 only operates LTE on 900MHz and 2500MHz (Take that with a grain of salt though; it may be incorrect or incomplete).


The Nexus 7 2013 apparently doesn't support either of those frequencies. Oddly enough, apparently neither does the iPad Mini.


You may want to contact Aero2 or whatever local providers and find out which frequencies (or "bands") they operate in your area. It doesn't matter if their network or SIM cards are "100% certified for the Nexus 7", they may not operate the appropriate frequencies in your area specifically. Rather than ask "Do you support the N7?", ask them "What LTE bands are operational in the area with the postal code [your postal code]?"


If your area should have a band that's listed on the GSMArena page for the Nexus 7, then you may have problems with your device. If not, then you may want to find a carrier that supports LTE on the appropriate bands in your area.


Friday, February 15, 2019

root access - Not able to install google apps after following the suggested steps


I have a retail tablet(Crystal Audio, GR) that after many tries I have managed to root it, with Kingo Root. I can the application SuperSu installed and when I am trying to perform root actions, it asks me for granting privileges. Everything godd, up here.


I have followed the steps described here (moved apks to system and try to install them etc) but I cannot install them. After tapping the apks and clicking install, it returns with an error "Installation not done". I have tried to do it with adb, but I am not allowed to remount /system as rw(kernel issue?).


How to proceed? Any ideas appreciated.



Answer



The solution that seemed to work, at last, was the following. I connected the tablet with USB into my PC. Then downloaded the signed package of gapps for my Android version, from http://Goo.im and moved it in the same dir as the adb executable.


After that, I booted the tablet in recovery mode, chose the option "Update from ADB", and run the command "adb sideload gapps.zip", where gapps.zip is the filename downloaded earlier. Everything run good and I can now see, the necessary services.


Thursday, February 14, 2019

rooting - How to root Asus Fonepad 8 tablet?



I want to root my tablet Asus Fonepad 8. How do I do it? I tried iroot, kingoroot, root my device, and etc, but to no avail?




Wednesday, February 13, 2019

linux - How does the Ubuntu Phone OS relate to the Android OS?


I've read that the new announced Ubuntu Phone OS was heavily inspired by Android, while not using Java and the Dalvik VM for its apps.


However, it was also not clear whether it's a fork of the AOSP or a custom ROM (I doubt it) or just if it's conceptually inspired by Android or some part of it was forked from Android (i.e. kernel, etc.).


Would Android apps possibly be able to work on Ubuntu Phone OS?



Answer



Both Ubuntu Phone (which is based on the same Linux distro as full Ubuntu) and Android run on a Linux kernel. However they differ above the kernel level, whereas Ubuntu runs a full GNU/Linux OS with most of the standard Linux libraries, and a GUI based on Qt, Android runs a custom Android and Dalvik platform instead.


It looks like one of the big benefits of them both being based on the same Linux kernel is driver support. This means that for any Android phone that has open-sourced drivers available (either officially from the manufacturer's source, or where a 3rd party ROM developer has written them), it should be a much easier to task to get Ubuntu Phone running on it. (notably pretty much every picture on the Ubuntu Phone site at the moment looks like it's of a Galaxy Nexus running Ubuntu Phone).



Ubuntu has already been adapted to run on chipsets using the ARM and Intel x86 architectures relevant for mobile devices, with the core system based around a typical Android Board Support Package (BSP). So chipset vendors and hardware manufacturers do not need to invest in or maintain new hardware support packages for Ubuntu on smartphones. In short, if you already make handsets that run Android, the work needed to adopt Ubuntu will be trivial.




(from http://www.ubuntu.com/devices/phone/operators-and-oems - my emphasis)


This means that, initially at least, it's phone manufacturers and Ubuntu enthusiasts who are going to see the biggest benefit - that it should be fairly easy to get Ubuntu Phone working on a handset that was designed for Android (and fairly easy to sell the same hardware with a choice of OS).


As the vast majority of Android apps are written using Java for the Dalvik VM, neither of which are guaranteed to be on an Ubuntu Phone (though enthusiasts may port them later) most of those apps won't work without a large amount of porting effort. Ubuntu themselves are unlikely to be in a hurry to port Java and Dalvik to Ubuntu Phone after the legal problems that Google have had with Oracle.


Also the Ubuntu Phone has it's own QML toolkit and Ubuntu SDK, neither of which are the same as (or compatible with) the Android SDK or NDK APIs, so again that's going to be a large amount of porting effort that will prevent Android apps from being run on Ubuntu straight away.


On the other hand, if your app is primarily a web app with an Android wrapper around it, then porting should be much easier as both heavily support HTML5 and Javascript.



Web apps are first class citizens on Ubuntu, with APIs that provide deep integration into the interface. HTML5 apps written for other platforms can be adapted to Ubuntu with ease, and we’re targeting standard cross-platform web app development frameworks like PhoneGap to make Ubuntu ‘just work’ for apps that use them.



(from http://www.ubuntu.com/devices/phone/app-ecosystem)



Despite all of those differences, history in the mobile space has shown us that if a mobile platform takes off in a big way, then no matter how big the time and effort needed to port apps between platforms, all the big apps and games will make their way to the new platform eventually and companies will come out with toolkits and software that makes it easy to write an app once that can then be compiled to run on any of the major platforms (that allow it).


It seems that most of Ubuntu's app-portability is concentrating on making it easy to convert web apps into Ubuntu Phone apps, and to make it easy to run exactly the same app on any Ubuntu device - desktop, laptop or phone:



With the arrival of the Ubuntu SDK, apps can be written to work on all Ubuntu form-factors: it’s the same Ubuntu OS on the desktop and on the phone, so a single native application can work on both. Which means you re-use most of the app when you add support for a new form-factor.



(from http://www.ubuntu.com/devices/phone/app-ecosystem)




tl;dr


Ubuntu Phone and Android are both based on a Linux kernel but are different above that - they can share drivers (this is good for manufacturers and hobbyists), but can't share apps. Ubuntu Phone shares apps with desktop Ubuntu, not with Android. They both have good web browsers and can view the same web pages.


Backup/Restore SMS/MMS via ADB on a non-rooted device?


Is there any way to backup/restore SMS and MMS messages using ADB, when the device is not rooted?



  • adb pull won't work here, as the corresponding database (/data/data/com.android.providers.telephony/databases/mmssms.db) cannot be read by ADB if it's not running in insecure (root) mode

  • adb shell "cat /data/data/com.android.providers.telephony/databases/mmssms.db > /sdcard/mmssms.db doesn't work either without root access

  • adb backup for some reason doesn't cover this database on the device I've checked with (empty backup – just the 41 bytes of the backup header in the resulting file)



I especially wonder why adb backup doesn't cover this. If it's for "privacy reasons", then the same should apply to the contacts database – which clearly is backed up.


References:



So: Any solution on a non-rooted device? Note that I'm NOT asking for an app-based solution. I'm fully aware there are several apps available for this. I specifically want a "shell based solution", to be used via ADB.




linux - How to configure and Enable WiFi Hotspot through terminal without ROOT


How can i configure and enable/disable the WiFi Hotspot by using terminal command without ROOT? Also I want to kick user from my hotspot using terminal command




Tuesday, February 12, 2019

clockworkmod recovery - How do I recalibrate the battery of my phone?



After a year using my phone, I noticed the battery drains too fast, but after shutting down I manage to make it work again for a couple of minutes before it shuts down automatically.


I read that to recalibrate the battery, you should fully charge it and by various means delete the batterystats.bin file. (examples with clockworkmod or using an app)


The thing is...



"When you follow the steps to recalibrate your battery and delete the batterystats.bin file from your phone, you are getting rid of more than what you think… Stored inside that batterystats.bin file, your phone keeps detailed logs of the capacity of your battery and uses it on how it can be utilized more efficiently." Read Full



or oppositely, quoting Dianne Hackborn



"It (refering batterystats.bin) has no impact on your battery life."




I know it's not possible to make it as good as new, but at least reset it in a way it would read that last bit of energy accurately?



Answer



Android shuts down your OS before it actually becomes completely flat, in order to ensure it has enough power to do so safely and completely (which is why you can power it back up again, but then it shuts itself off again). Over time, your battery does need to be recalibrated as the system stats on battery usage get wonky and the battery itself won't store as much of a charge as it could.


For most phones, the proper procedure is:



  1. Let the phone run until it shuts itself off.

  2. Without turning the phone on, plug it in and let it fully charge up.

  3. Unplug, turn the phone on and let it run flat again.

  4. Battery and battery stats are now recalibrated.



Deleting batterystats.bin isn't generally necessary.


You should find your battery lasting much longer now (I know this works well on my Samsung SK4G - I go from not being able to last the day to being able to last a full day and night)


If memory serves, one is supposed to recalibrate one's battery like this every 30-90 days.


4.4 kitkat - Nexus 5 > Lollipop upgrade notification lost


I have an LG Nexus 5 and I am running Android 4.4.4 on it.


I've been seeing a notification telling me there's an upgrade for my Android OS for several weeks now (Lollipop upgrade), but I've been waiting till I properly back up my phone before starting the upgrade.



When I was finally ready to run the upgrade yesterday, the notification was gone. I went to Settings > About phone > System updates, clicked on "Check for update" only to find it saying "Your system is up to date".


The "Last checked for update at" message was changed to the current time.


Rebooting the phone and trying again did not help either.


Is there anyway I can get that Lollipop update back?




applications - How can I see how much internet bandwidth each process is using at the moment?


On Android, I have a nice Xposed module which shows me the current internet usage, but for the whole system, not per app:




On my desktop computer I have this expandable panel item which shows me exactly which apps are using the internet connection at any given moment. It also shows me exactly how much they're uploading and downloading per second right now, on a per app basis. The UI looks like this:


enter image description here


So I wonder if this is possible on Android as well. I'm asking for a per app metric of up/down usage right now, as in the above screenshot from my desktop computer.


Is there any way to get that?


To clarify even more, I'm asking for current speed, not past, accumulated usage.


Solutions that require root access and Xposed Framework are welcome.



Answer



Simple System Monitor does that


Relevant feature from app description




View list of active apps and processes and their CPU usage, RAM usage, network activity, PID and UID.



If you monitor the Active Processes tab you can see the change in data usage. You can order the view based on parameters as shown in the second screen shot. The default update interval in settings is 3 seconds which can be varied as per need. If you worried about battery consumption , you can pause the app from the menu option on top left


enter image description here enter image description here


Why can I not assign exec permissions to a file on the SD card?


shell@android:/sdcard/SW # ls -l
-rw-rw-r-- root sdcard_rw 128 2012-09-22 11:42 usb0config.sh

shell@android:/sdcard/SW # chmod 777 usb0config.sh
shell@android:/sdcard/SW # ls -l
-rw-rw-r-- root sdcard_rw 128 2012-09-22 11:42 usb0config.sh
shell@android:/sdcard/SW #

Why can I not assign exec permissions to a file on the SD card?


$ adb shell su -c mount |grep -si sdcard
/dev/block/vold/179:97 /mnt/ext_sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/ext_sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/fuse /mnt/sdcard fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0



$ adb shell su -c "mount -t vfat -o umask=0000 /dev/fuse /mnt/sdcard"
mount: Block device required

Now it seems remount successfully.


$ adb shell su -c "mount -t vfat -o remount,umask=0000 /dev/fuse /mnt/sdcard"

but the file yet cannot be assigned 777 mode.


shell@android:/sdcard/Sw # ls -l

-rw-rw-r-- root sdcard_rw 128 2012-09-22 11:42 usb0config.sh
shell@android:/sdcard/Sw # chmod 777 usb0config.sh
shell@android:/sdcard/Sw # ls -l
-rw-rw-r-- root sdcard_rw 128 2012-09-22 11:42 usb0config.sh

The mount info doesn't change comparing to before remount's.


$ adb shell su -c mount |grep -si sdcard
/dev/block/vold/179:97 /mnt/ext_sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/ext_sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/fuse /mnt/sdcard fuse rw,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0


Answer



Unless you've done something unusual with your device, the SD card will be formatted as a FAT file system, which does not support *nix file permissions. This Linux FAQ entry from one of MIT's professors explains it a bit, and also explains how you can potentially use mount options to change the permission mode of the device (this would require root, though, and affect all files/folders on the device). Also, the SD card in Android is mounted by default with the -noexec flag.


For the exec bit you'd probably want to remount with a umask of 0000, since the umask is essentially a binary NOT of the permissions you want (so umask 0000 says don't mask out any permissions, allow them all). Untested, but doing it temporarily would be something along the lines of:


mount -t vfat -o umask=0000 /dev/your/sdcard/device /mnt/sdcard

The mount point may need to be changed from /mnt/sdcard to something slightly different depending on your device. Again, though, I believe mount requires that you have root permissions for this.


Monday, February 11, 2019

applications - Is there a Network manager app with profiles to allow only specific apps to use data?



Is there an app with which one can set up multiple profiles, each containing allowed apps that can access the internet? I want a WORK and HOME profile to switch between. (preferably without rooting?)





wi fi - How can I disable cellular data on an Android device?


Can I easily disable cellular data on an Android device and just use Wi-Fi? Does this change based on whether or not I have root on the device?



Answer






  1. You can pretty easily disable cellular data on an android device without root. On Android 2.2 and above, you can go to home --> menu --> Settings --> Wireless & networks --> Mobile networks --> and then uncheck Data enabled (on phones with Motoblur, the Data enabled setting might be in home --> menu --> Settings --> Data manager --> Data Delivery instead; YMMV).


    If you have Android 2.1 or less, or just want a widget that will let you turn mobile data on and off, there are several apps that do the trick, for example Widgetsoid and APNdroid.




  2. Like Matthew Read said, the major carriers won't let you put a smartphone on their network without a data plan. However, you might have better luck with smaller carriers that operate on the big carriers' networks. You end up getting better prices but the same coverage areas. For example, Walmart Family Mobile plans include unlimited talk and text, and pay-as-you-go for data. So if you don't use any data, you don't pay for data. They run on T-Mobile's network, and you can either buy one of their phones, use a T-Mobile phone, or an unlocked GSM phone. Here are a few other examples:



    And then you've got other carriers that operate their own smaller networks, but have roaming deals with the bigger carriers, so once again you still get coverage areas comparable to the major carriers:



    There's a more comprehensive list of US wireless companies that operate on the larger companies' networks here:



    http://en.wikipedia.org/wiki/List_of_US_MVNO




rooting - Unable to flash TWRP on a LG G4 (LG H815)


I own an international LG G4 LG H815 and running Ubuntu 14.04 LTS. For the whole day I am unable to flash TWRP on the phone. First I unlocked the bootloader with succes. Now I am trying to flash TWRP on the phone, commands that I used are :


mark@Mark-PC:~/Bureaublad/LG_G4_unlock/Root$ adb reboot bootloader
@Mark-PC:~/Bureaublad/LG_G4_unlock/Root$ sudo fastboot flash recovery twrp-2.8.6.0-hima.img
target reported max download size of 536870912 bytes
sending 'recovery' (35928 KB)...
OKAY [ 1.440s]
writing 'recovery'...
OKAY [ 0.353s]

finished. total time: 1.793s

After flashing I immidiately turned of the phone by pulling out the battery to prevent normal booting. Every time I boot in the normal stock recovery that offers my to perform a factory reset.


I was reading the question flashing twrp on lg g4 no error, but no twrp but tries were also not succesfull. Chosing yes in the stock recovery wiped the data instead of booting to TWRP. I tried the same with different versions of TWRP for the LG H815 and of them gave the same result. My LG G4 is running Android 5.1 stock ROM without root.


I was also unable to find a file to flash by using fastboot that offers root access to flash a recovery from Android. All of the methods to root requires a working TWRP recovery.


mark@Mark-PC:~/Bureaublad/LG_G4_unlock/Root$ sudo fastboot boot twrp-2.8.6.0-hima.img 

Booting of the image directly did also not work


I will be very happy when I am able to salve this problem.


Now I tried this manual on another Windows laptop : https://techbeasts.com/2015/06/16/install-twrp-recovery-on-lg-g4-root-it/



but after the commands


C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot boot recovery.img
downloading 'boot.img'...
OKAY [ 0.710s]
booting...
OKAY [ 0.400s]
finished. total time: 1.117s

unfortunately it boots normal after 20 seconds and stays unaffected.




Sunday, February 10, 2019

root access - How to run an Android init service with superuser SELinux context?


I want to run an Android init service. I have a device which has rooted shell (purchased from manufacture as rooted). This device doesn't have Magisk or other su manager but adb shell is rooted and it has userdebug ROM installed on it.


I have followed following steps to set up init service:



  1. Created /etc/init/custom.rc file with following contents:


#/etc/init/custom.rc


# define service, use executable here if script not needed
service custom /system/bin/custom.sh

# don't start unless explicitly asked to
disabled

# run with unrestricted SELinux context to avoid avc denials
# can also use "u:r:su:s0" on userdebug / eng builds if no Magisk
# it's required if SELinux is enforcing and service needs access
# to some system resources not allowed by default sepolicy

# seclabel u:r:magisk:s0
seclabel u:r:su:s0

# start the service when boot is completed
on property:sys.boot_completed=1
start custom


  1. Created /system/bin/custom.sh with following contents:



#!/system/bin/sh

# execute the binary, should run in foreground, otherwise get in loop
echo "$(date): Starting program..."
exec /system/bin/executable


  1. Placed my executable at /system/bin/executable.

  2. Gave permissions to all files as following:



# Give rights to the executable
chown 0.0 /system/bin/executable
chmod 554 /system/bin/executable
chcon u:object_r:system_file:s0 /system/bin/executable

# Give rights to the custom.sh
chown 0.0 /system/bin/custom.sh
chmod 554 /system/bin/custom.sh
chcon u:object_r:system_file:s0 /system/bin/custom.sh


# Give rights to the custom.rc
chown 0.0 /etc/init/custom.rc
chmod 644 /etc/init/custom.rc
chcon u:object_r:system_file:s0 /etc/init/custom.rc


  1. Reboot the system.


I got following error:


[   55.829099 / 06-09 23:51:09.279][0] init: cannot execve('/system/bin/custom.sh'): Permission denied

[ 55.850172 / 06-09 23:51:09.309][6] init: Service 'custom' (pid 7729)
[ 55.850224 / 06-09 23:51:09.309][6] init: Service 'custom' (pid 7729) exited with status 127
[ 55.850243 / 06-09 23:51:09.309][6] init: Sending signal 9 to service 'custom' (pid 7729) process group...
[ 60.830224 / 06-09 23:51:14.289][6] init: starting service 'custom'...
[ 60.832073 / 06-09 23:51:14.289][1] init: cannot execve('/system/bin/custom.sh'): Permission denied
[ 60.832153 / 06-09 23:51:14.289][3] audit: type=1400 audit(1560142274.289:131): avc: denied { transition } for pid=8035 comm="init" path="/system/bin/custom.sh" dev="sda24" ino=8146 scontext=u:r:init:s0 tcontext=u:r:su:s0 tclass=process permissive=0

I have very little experience with SELinux Policies. Please guide me how can I fix this.



Answer



Here the error is:



audit: type=1400 audit(1560142274.289:131): avc: denied { transition } for pid=8035 comm="init" path="/system/bin/custom.sh" dev="sda24" ino=8146 scontext=u:r:init:s0 tcontext=u:r:su:s0 tclass=process permissive=0

In easy words it states that init is running with its context u:r:init:0, you want it to execute /system/bin/custom.sh with context u:r:su:s0, but it's not allowed in sepolicy.


Rooting a phone gets two things: UID 0 (which you have) and an unrestricted SELinux context (which you don't have). Magisk allows any other context to do anything with its own contexts (u:r:magisk:s0 and u:object_r:magisk:s0). And it can do anything to any other context. See details in this answer.


u:r:su:s0 is a limited context which doesn't allow init to make transition to itself. Only adb can do this on userdebug or eng builds of a ROM. See reference and this answer for details.


Possible solutions:



  • Run service in init's context if it doesn't need to access any resources which init isn't allowed to access. But in most cases it's highly unlikely.

  • Root your device with Magisk and run service with u:r:magisk:s0 context as explained in this answer.



  • Modify your SELinux policy to allow this transition. Inject the following statement to sepolicy using magiskpolicy or sepolicy-inject:


    ~# magiskpolicy --live 'allow init su process transition'
    ~# sepolicy-inject -s init -t su -c process -p transition -l

    Also see dmesg for any other denials. As a reference, on my device init is allowed to do following operations to Magisk:


    allow init magisk : process { fork transition sigchld sigkill sigstop signull signal ptrace getsched setsched getsession getpgid setpgid getcap setcap share getattr setexec setfscreate noatsecure siginh setrlimit rlimitinh dyntransition setcurrent execmem execstack execheap setkeycreate setsockcreate getrlimit }
    allow init magisk : fifo_file { read write getattr open }
    allow init magisk : fd use
    allow init magisk : unix_stream_socket { getopt connectto }
    allow init magisk : binder { impersonate call set_context_mgr transfer }


    Then extract boot.img and ramdisk (only on non-system-as-root devices), replace /sepolicy with new policy file copied from /sys/fs/selinux/policy, repack boot.img and flash back.




  • Set SELinux permissive


    From root adb shell do echo -n 0 >/sys/fs/selinux/enforce or setenforce 0. However this is not permanent and will be set to enforced on boot. init can't set it permissive. Also setting SELinux permissive is a security risk and hence never recommended.




bootloader - Format Preloader and reflash (mtk6582) Sp flashtools


The problem is that spflash tools says:


"PTM changed for the ROM: It must be downloaded."


The solutions are, download the preloader.bin (not work for me), and format all + download....


but I want not format /system either /data .....



I've try do manually format (except bootloader, system and data) but the problem is not solved .... Can some one help me?




I have a Importart question


What happen If I manually format the Bootloader of my mt6582, If I do manually for example (it's for my phone), erases from (0x0000000000000000 to 0x0000000000c00000) >> (bootloader to begin of mbr).... Then I would like download the preloader.bin with spflash tool.


Could it brick my phone?


Note: I want not do a readback




AnkiDroid - failed to Left Align Text


I'm trying to left align text in card but with no luck.


Tried changing text-align to left in Anki desktop, the card in desktop working fine, but it doesn't affect the card in mobile - it's still center aligned.


Also tried add html tag as follows, but still not working. (AnkiDroid version 2.3.2)


use p align still centered
use p align / still centered (click images for larger variants)



Answer



To use any HTML markup but simple bold/italics in cards, you need to turn off the option Advanced -> Simple interface.


cyanogenmod - "adb devices" gives "no permission" when on charge-only


I've just updated my LG Optimus 4X HD from the latest stock ROM (4.1) to CM11 (Android 4.4). Access via ADB is only possible when either MTP or PTP are enabled; if I disable both, I only get:


$ adb devices
List of devices attached
???????????? no permissions

I wouldn't really bother – but with PTP enabled, I always get a popup asking me to mount the "new device"; with MTP, additionally an error message for not being able to access the camera. This is pretty annoying: I never had it with this device before the upgrade, and I never experienced this with any other of my devices.


The "USB Connection" settings page only offers two checkboxes: MTP and PTP, the "Charge only" item is missing (and should obviously be reflected by unticking both MTP and PTP). Computer runs on Linux, in case it's relevant (and has no MTP software installed as I don't need it).


Is there any way to get rid of those annoying popups and still have ADB working? I'm fine with something to be executed via ADB, like adb shell setprop and, if proven stable, to integrate with built.prop.



Answer




Thanks to the pointer provided by Firelord, I was able to solve the issue. The solution might look weird, but works perfectly:


As root, edit /data/property/persist.sys.usb.config. The only line in that file should read:


mass_storage,adb

We all know there is no anymore with Kitkat (except maybe rare exceptions). Well, maybe that's the reason nothing "pops up" anymore, offering to mount some resource :)


To revert from this, either:



  • open the notification area while connected via USB, find the "connected as …" notification, and tap it

  • or: go to Settings › Storage, tap the "overflow menu button" (the "3 stapled dots"), and tap the (only) entry which reads like "USB connection"



Then select either MTP or PTP, and there you are.


References:



  • This is the content of /data/property/persist.sys.usb.config on one of my tablets running Android 4.1 (stock)

  • This setting is mentioned in this answer, saying if you want to eanble ADB, you can setprop persist.sys.usb.config=mass_storage,adb


Postscriptum


Thanks to the context, one could set up some "toggle" using , executing either setprop persist.sys.usb.config=mass_storage,adb (to "get rid of the popups"), setprop persist.sys.usb.config=ptp,adb (to have it back in PTP mode), or setprop persist.sys.usb.config=mtp,adb to re-enable MTP for data transfer. I don't need any of this, as I use adbfs to access my files ;)


samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...