Android system update button

How to Enter and Use Android Recovery Mode

By Avery Pacheco , 30/10/2014, updated on 04/01/2021

The other day, some people ask me for Android Recovery Mode. They are wondering what Android Recovery Mode uses for. Are you interested in it like them? Now I will tell something about this function.

People Also Read:

Android Recovery Mode is a feature of Android Device. You don’t need to install some program on your phone or connect to other devices. Just make your Android Power off and via keys combination to access this mode. Android Recovery Mode including update software manually, clear cache partition, update from Android Debugging Bridge.

Part 1: What is Recovery Mode on Android?

What is Recovery Mode of Android Device?

Recovery mode refers to the bootable partition in Android phone, in which the recovery console is installed. Once entering this mode, users might access a few core functioning in their own device. Recovery mode provides features to help users fix installations as well as install official OS updates by using a combination of key presses or instructions from a command line sometimes.

What does it for? In the past, a phone is more of a device used to make calls or text. However, it’s much more than that. Most Android devices are now defaulted with a fairly simple Recovery mode with features like Reboot System Now, Apply Update from ADB, Apply Update from External Storage, Wipe Data/Factory Reset, Wipe Cache Partition, Apply Update from Cache. Just like a lot of other things with Android, even the Recovery Mode can be customized to do more things. To gain further knowledge, please scroll down and read on.

How Does Recovery Mode Help?

Reboot System Now

This option is indicating to restart your phone. You Android will power off and then reboot into the commend interface. When you have completed the recovery mode, select it.

Apply Update from ADB

To use this function, you’d better connect Android and computer to enable to build the «bridge» between them. Android Debugging Bridge allows you to run Android Device and do some operation through computer to Android. Android App developer will repair bugs of applications via this option. Of course you can use computer to send and install update onto your phone by connecting Android and computer. This could be pretty rarely used for person but if you ever need to use this tool you can often find step-by-step instructions by performing a quick search online.

Apply Update from External Storage

Maybe your phone always successfully to connect to PC neither via USB cable nor Wi-Fi and you want to download applications, music, photo or any other data from computer to Android. So you will take the method of using phone memory card to be the bridge of computer and Android phone. Plug the card from Android and put it into computer. Then download something you want to and reinsert the memory card to mobile phone. But how to update information of your memory card to enable Android device to detected the new content of it? This time you can use this tool, apply update from external storage. When you click this option, Android phone will discover the new data.

Wipe Data/Factory Reset

It is obviously that when you want to sell or throw away your old phone, to clear up all the data in it will be secret and safe. So wipe data/factory reset will do you a favor to delete all information of your phone and restore to factory settings stage.

Wipe Cache Partition

Are you accustomed to clear cache? Cache is always ignored by us and piled up in anytime. As we use Android cache can tend to pile up and I am not just referring to apps, photos or text messages. Some of these that can add up over time run in the background of the device and we don’t even know it! This temporary data is stored in the phones memory and can help the phone boot up quicker or help your apps run faster. Performing a wipe cache partition clears out some of this temporary data can help prevent troublesome issues. It’s important to note that choosing to wipe cache partition will remove data from your device but only temporary data and it doesn’t remove or erase any personal information or user data from the device.

Читайте также:  Ловить зомби для андроид

Tips: As lots of users complained about the bricked phone, actually «wipe cache partition» can fix most cases. Just get your device into recovery mode and select this mode with the volume key. After that, reboot the system to get it back to normal. This method works for many devices.

Apply Update from Cache

Applying update from cache is rarely in used to update mobile phone but you don’t have computer and memory card to update your device.

It will download the update file to your phone via the phones wireless data connection. Although Wi-Fi connection will be a faster way to download, the update file can be downloaded using an internet connection provided by either your mobile data or a Wi-Fi connection. I suppose the file could be downloaded to a PC and then transferred to the phones files system that way as well. In any case the update file could be put into the cache directory which you need to have Super User permission to do, thus your phone needs to be rooted.

After the update file is in your cache folder you should be able to shut off your, boot into the Android Recovery Mode screen, highlight and select the «apply update from cache» option. By the way, you may have to manually select the update file you want to apply, once selected the update should begin.

Part 2: How to Enter Recovery Mode Manually on Android Devices of Brands?

Now how to enter Android Recovery Mode? The method is going to vary from device to device. Generally, shut down Android and make sure it unplugged to the charge. If you have no idea, it’s a good idea to follow the onscreen instructions as below.

Samsung Galaxy Phones:

Step 1. Power off your Android by pressing the «Power» button and select «Power off».

Step 2. Press and hold down «Volume Up», «Power» and «Home» buttons at the same time until the device turns on.

Step 3. Now, your device goes into «Recovery Mode».

LG Phones:

Step 1. Power off your LG G phone.

Step 2. Press and hold the «Power», «Volume Down» buttons simultaneously.

Step 3. When a menu appears, release your fingers.

Step 4. Then navigate to «Recovery mode» and use the Volume keys to select certain option but confirm the choice with «Power» key.

HTC One Series:

Step 1. First of all, disable Fastboot of your HTC One 9/One 8 by entering «Settings» > «Battery» and disabling Fastboot.

Step 2. Turn off your HTC One phone.

Step 3. Press down the «Power» and «Volume Down: buttons at the same time for 10 seconds.

Step 4. When you see a pop-up menu with the «Recovery mode» option, you can release you finger.

Step 5. Then go to that option and press the «Power» button to enter.

Nexus Phones:

Step 1. Hold down «Power» key and «Power off» your Nexus phone.

Step 2. Press and hold down the «Power», «Volume Down» keys together for seconds.

Step 3. Keep holding the buttons until a pop-up with «Recovery mode» option appears on the screen.

Step 4. Press the «Volume» buttons to select Recovery mode option.

Part 3: How to Enter/Exit Recovery Mode via Android Data Recovery?

Case 1: Normally Exit Store Recovery Mode

If you want to get out of Recovery Mode, the easiest way to go is choose «Reboot System Now» in the menu. It will restart your device and boot in the normal screen. Or, you might directly press down «Home» and «Power» buttons to forcibly shut down the device and then turn it on with «Power» button.

Case 2: Android Stuck in Recovery Mode

When your device goes wrong and it is necessary to save the phone data and put the device into recovery/download mode to fix your phone. At this point, you can follow the guide of Android Data Extraction to enter and exit the recovery mode as well as it can recover your broken device in some cases.

Step 1. After Android Data Extraction being installed on your computer, please launch it and select «Broken Android Phone Data Extraction» on the left panel.

Step 2. Click on «Fix Device» button and select «Others» according to your case.

Step 3. Choose your device information and boot into Download Mode.

Step 4. Click on «Start» and begin to fix the issue.

Источник

Buttons

A button consists of text or an icon (or both text and an icon) that communicates what action occurs when the user touches it.

Читайте также:  Почему iphone лучше android или

Depending on whether you want a button with text, an icon, or both, you can create the button in your layout in three ways:

  • With text, using the Button class:
  • With an icon, using the ImageButton class:
  • With text and an icon, using the Button class with the android:drawableLeft attribute:

Key classes are the following:

Responding to Click Events

When the user clicks a button, the Button object receives an on-click event.

To define the click event handler for a button, add the android:onClick attribute to the element in your XML layout. The value for this attribute must be the name of the method you want to call in response to a click event. The Activity hosting the layout must then implement the corresponding method.

For example, here’s a layout with a button using android:onClick :

Within the Activity that hosts this layout, the following method handles the click event:

Kotlin

The method you declare in the android:onClick attribute must have a signature exactly as shown above. Specifically, the method must:

  • Be public
  • Return void
  • Define a View as its only parameter (this will be the View that was clicked)

Using an OnClickListener

You can also declare the click event handler programmatically rather than in an XML layout. This might be necessary if you instantiate the Button at runtime or you need to declare the click behavior in a Fragment subclass.

To declare the event handler programmatically, create an View.OnClickListener object and assign it to the button by calling setOnClickListener(View.OnClickListener) . For example:

Kotlin

Styling Your Button

The appearance of your button (background image and font) may vary from one device to another, because devices by different manufacturers often have different default styles for input controls.

You can control exactly how your controls are styled using a theme that you apply to your entire application. For instance, to ensure that all devices running Android 4.0 and higher use the Holo theme in your app, declare android:theme=»@android:style/Theme.Holo» in your manifest’s element. Also read the blog post, Holo Everywhere for information about using the Holo theme while supporting older devices.

To customize individual buttons with a different background, specify the android:background attribute with a drawable or color resource. Alternatively, you can apply a style for the button, which works in a manner similar to HTML styles to define multiple style properties such as the background, font, size, and others. For more information about applying styles, see Styles and Themes.

Borderless button

One design that can be useful is a «borderless» button. Borderless buttons resemble basic buttons except that they have no borders or background but still change appearance during different states, such as when clicked.

To create a borderless button, apply the borderlessButtonStyle style to the button. For example:

Custom background

If you want to truly redefine the appearance of your button, you can specify a custom background. Instead of supplying a simple bitmap or color, however, your background should be a state list resource that changes appearance depending on the button’s current state.

You can define the state list in an XML file that defines three different images or colors to use for the different button states.

To create a state list drawable for your button background:

    Create three bitmaps for the button background that represent the default, pressed, and focused button states.

To ensure that your images fit buttons of various sizes, create the bitmaps as Nine-patch bitmaps.

Источник

Как работает SystemUI в Android

В этой статье я разберу архитектуру и принцип работы основного приложения Android — SystemUI. Меня заинтересовала эта тема, потому что мне интересно, как устроена система, которой пользуется такое огромное количество пользователей и для которой ежедневно выкатываются тысячи приложений в Google Play или просто на просторы интернета. Помимо этого меня интересует вопрос информационной безопасности Android и создаваемых под него приложений.

В системе Android, SystemUI — это приложение, путь к исходному коду которого находится в platform_frameworks_base/packages/SystemUI/, на девайсе оно находится в system/priv-app/-SystemUI.

priv-app — это каталог, где хранятся привилегированные приложения. К слову, по пути system/app лежат предустановленные приложения, а обычные приложения, которые мы устанавливаем на свой девайс самостоятельно, хранятся в data/app.

Тут сразу возникает вопрос: почему нельзя засунуть все предустановленные и привилегированные приложения в один каталог, зачем нужно это разделение?

Дело в том, что некоторые приложения более системные, чем другие:) И это разделение необходимо для того чтобы уменьшить покрытие эксплойтами системных приложений, для получения доступа к защищенным операциям. Можно создавать приложение, которое будет иметь специальный ApplicationInfo.FLAG_SYSTEM и в системе получит больше прав, однако apk файл с таким разрешением будет помещен в раздел system.

Итак, SystemUI — это apk-файл, который по сути своей обычное приложение. Однако, если посмотреть на сложное устройство SystemUI, перестает казаться, что это всего лишь простое приложение, верно?

Данное приложение выполняет весьма важные функции:

Запуск SystemUI

Как я и говорила выше, SystemUI не похож на обычное приложение, так что его запуск не сопровождается запуском активности, как это происходит у большинства приложений. SystemUI — это глобальный пользовательский интерфейс, который запускается во время процесса загрузки системы и не может быть завершен.

Читайте также:  Gps тест для андроида

Если мы залезем в SystemServer, который является одним из двух столпов в мире Android (второй — Zygote, но об этом я расскажу как-нибудь в другой раз), то мы можешь найти место, где стартует SystemUI при загрузке системы.

Тут мы видим как запускается сервис SystemUI с помощью непубличного API startServiceAsUser. Если бы вы захотели использовать это, то вам пришлось бы обратиться к рефлексии. Но если вы решите использовать reflection API в Android — подумайте несколько раз, стоит ли это того. Подумайте раз сто:)

Итак, тут создается отдельный процесс для приложения и по факту каждый раздел SystemUI является отдельным сервисом или независимым модулем.

Метод start() вызывается для запуска каждой службы, которые перечислены ниже.

Регулирование громкости

Мы регулярно пользуемся кнопками громкости на своих устройствах, но не задумываемся какие процессы должны произойти в системе для того чтобы мы могли прибавить или убавить звук. Операция кажется довольно простой на словах, но если заглянуть в VolumeUI, который находится в подпапке SystenUI/volume, в разных режимах интерфейс имеет свою вариацию.


Я уже говорила о том, что сервисы SystemUI запускаются методом start(). Если мы посмотрим на класс VolumeUI, то он тоже наследуется от SystemUI.

Тут мы видим что с помощью mEnabled мы определяем, следует ли нам показывать панель с настройкой звука. И судя по VolumeDialogComponent, VolumeUI отображает звуковую панель в виде диалога. Но все действия относительно нажатия на клавиши громкости обрабатываются в PhoneWindow.

Насколько мы видим, KEYCODE_VOLUME_UP (+) не обрабатывается и перейдет в обработку KEYCODE_VOLUME_DOWN (-). И в обоих событиях, как в onKeyDown, так и в onKeyUp вызывается метод dispatchVolumeButtonEventAsSystemService.

Итак, тут у нас вызывается метод adjustVolume, для того чтобы мы могли проверить наш direction, которому будет присвоен параметр события.

В итоге когда мы доберемся до AudioService, где будет вызван sendVolumeUpdate, где помимо вызова метода postVolumeChanged, будет установлен интерфейс HDMI.

RingtonePlayer

RingtonePlayer в Android выполняет роль проигрывателя. Он так же наследуется от SystemUI и в методе start() мы видим:

Здесь у нас устанавливается mCallback, который по сути является экземпляром IRingtonePlayer.

В итоге можно управлять RingtonePlayerService с помощью Binder для воспроизведения звуковых файлов.

PowerUI

PowerUI отвечает за управление питанием и уведомлениями. Аналогично наследуется от SystemUI и имеет метод start().

Как мы видим из приведенного выше кода, происодит подписка на изменения Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, а после — вызов mReceiver.init().

Тут регистрируется широковещательный приемник, с помощью которого происходит отслеживание изменений.

Задачи

Recents — это основная и часто используемая функция в мобильных устройствах на базе Android.

Главные функции:

  • Отображение всех задач
  • Переключение между задачами
  • Удаление задач

Помимо этого Recents так же наследуется от SystemUI. В RecentsActivity происходит создание и обновление последних задач, чтобы мы могли увидеть их на нашем экране.


А в с помощью RecentTaskInfo мы можем получить информацию о конкретной задаче.

Вообще, запущенные задачи можно вынести в отдельную тему. Я изучила ее со всех сторон, так как хотела размывать экран приложения перед переходом приложения в background, чтобы в RecentsTask отображалась нечитаемая версия снапшота. Однако, проблема заключается в том, что снапшот приложения берется раньше, чем вызывается onPause(). Эту проблему можно решить несколькими способами. Либо выставлять флаг, чтобы система просто скрывала содержимое экрана с помощью

О чем я говорила в предыдущей статье, посвященной как раз снапшотам.

Можно вообще сделать так, чтобы конкретная activity приложения не отображалось в задачах, проставив в манифесте

Либо можно воспользоваться хитростью с помощью

Можно задать основной активности выше приведенный флаг excludeFromRecents = true, для того чтобы ее экран отсутствовал в запущенных задачах, но во время загрузки приложения запустить отдельную задачу, которая будет показывать либо размытый скриншот с основной активности, либо любое другое изображение. Более подробно, как это можно сделать описано в официальной документации на примере Google Drive.

Экран блокировки

Keyguard уже посложнее всех вышеприведенных модулей. Он представляет из себя сервис, который запускается в SystemUI, а управляется при помощи KeyguardViewMediator.

Однако на самом деле KeyguardService самостоятельно не работает с интерфейсом экрана блокировки, он лишь передает информацию в модуль StatusBar, где уже и производятся действия относительно визуального вида экрана и отображения информации.

Панель уведомлений

SystemBars имеет довольно сложное устройство и структуру. Его работа разделяется на два этапа:

  1. Инициализация SystemBars
  2. Отображение уведомлений

Если посмотреть на запуск SystemBars

То мы видим ссылку на ресурс из которого читается имя класса и создается его экземпляр.

Таким образом мы видим что тут вызывается StatusBar, который будет работать с выводом уведомлений и UI.

Я думаю никто и не сомневался в том, что Android устроен очень сложно и заключает в себе много хитростей, которые описаны в огромном количестве строчек кода. SystemUI является одной из самых важных частей этой системы и мне понравилось изучать ее. Из-за того что материала на эту тему очень мало, если вы заметите какие-либо ошибки, прошу исправить меня.

Источник

Оцените статью