How to increase the User accounts - Android Q&A, Help & Troubleshooting

Hello,
on a Note8 i can only create 5 User profiles
I change in build.prop fw.max_users=10
but it has no effects.
I read that:
As of Android 5.0, the multi-user feature is disabled by default. To enable it, device manufacturers must define a resource overlay that replaces the following values in frameworks/base/core/res/res/values/config.xml:
<!-- Maximum number of supported users -->
<integer name="config_multiuserMaximumUsers">1</integer>
Were can i change that?

Related

[ROM] MIUI | Stock | Language & Discussion Thread

MIUI ROM from the Far East​Official Links
MIUI English Site: http://en.miui.com/
MIUI Download Site: http://www.miui.com/download.html​Other XDA Links
MIUI General Discussion: http://forum.xda-developers.com/showthread.php?t=1060098
MIUI Guide: http://forum.xda-developers.com/showthread.php?t=1217527​
Other Sites
Russian Support: http://4pda.ru/forum/index.php?showtopic=197606
Spanish Support: http://miui.es/
Italian Support: http://www.nexus-lab.com/miui-rom-italian-packs/
Additional English Support: http://forums.miui-dev.com/
Some North American love: http://miui.us/​
Translation Instructions in Third Post​
PM me if this post needs updating!​
Translations
If you want to contribute to some translations try the initiative started here: >> CLICK HERE <<.
This is an unofficial effort, there is no assurance that any of this translation will ever make it to a final ROM.
Older Translation Packs
Mirror: http://djmcnz.batteryboss.org/MIUI/language/
[HOW TO] Create a MIUI Language Pack
Okay guys, there's a lot of demand for this rom and for language packs but not yet a lot of people who know how to make the packs. Whilst I set up the crowdin translation project I can not create or maintain language packs.
So, here's a summary of the instructions required to create a language pack for MIUI (indeed for any app/rom). You need a collection of tools and a little patience but the process isn't too difficult so do give it a go.
Also note that this summary includes generalisations for brevity. These instructions assume you have a deodexed rom.
Introduction
For the purposes of this post language information is stored in XML strings in files on the Android system. In the case of MIUI and these instructions we will be dealing with .apk files (applications).
Within the apk files is a resources directory (/res) and within this are various values directories, there is a default values directory (/res/values) and alternative language values directories (e.g. /res/values-DE and /res/values-IT).
If the rom is set to use it's default language it will read values from /res/values although these may NOT be in English. In MIUI, all of the common Android ASOP values in /res/values are English but the (additional) custom MIUI strings are in Simplified Chinese.
If you select a different language in the ROM than the default then the appropriate values directory will be searched. If a suitable string that matches your language selection is found in the alternative /res/values-xx directory then that string will be used instead. If an alternative does not exist then the default will be used.
Example:
Code:
/res/[COLOR="red"]values[/COLOR]/strings.xml
<stop_button_text>[COLOR="Red"]Stop[/COLOR]</stop_button_text>
/res/[COLOR="red"]values-DE[/COLOR]/strings.xml
<stop_button_text>[COLOR="red"]Halt[/COLOR]</stop_button_text>
/res/[COLOR="red"]values-IT[/COLOR]/strings.xml
<stop_button_text>[COLOR="red"]Basta[/COLOR]</stop_button_text>
In this example, if the language is set to the default the word "Stop" will be used, if it is set to German the word "Halt" will be substituted in, likewise "Basta" for Italian.
So, to add languages to a rom (or app) or to make an app multi-lingual you need to either change the default strings in /res/values/strings.xml to the ones you want to use or, and this is the preferable approach, add a /res/values-xx/strings.xml with the translations you want. The first approach will work (changing the default strings) but is not recommended because the Android Open Source Project and Android development in general, defaults to English. It's best to use the built in language substitution capabilities of Android rather than to work around them. Indeed, if the MIUI devs actually added their strings in English to /res/values/strings.xml and the Chinese equivalents in the appropriate directory this rom would already be in English!
Adding Languages
To add a translation file (strings.xml) to an apk you need to:
decode the apk
create a language directory
add the translation files
recompile the strings
add the new strings to the apk
Which all sounds a little daunting but it's really quite straight-forward, rewarding when you see the result and a good way to understand how parts of Android work. Here's how you can do it.
1. decode the apk
You will need the excellent apktool from brut.all which you can get from the link below. apktool is relatively easy to use but includes some little tricks so you will need to read the wiki and thread about it.
Do NOT just post problems about apktool if you can't get it to work. The tool DOES work so if it's not decoding (or encoding) your apps correctly then you're probably doing something wrong. If you start with this understand BEFORE you ask for support you'll get a lot more help...
apktool: http://code.google.com/p/android-apktool/
wiki: http://code.google.com/p/android-apktool/w/list
thread: http://forum.xda-developers.com/showthread.php?t=640592
Please make sure you run the following command to include the MIUI framework in apktool. You only need to do this once for each framework. If apktool works with one rom and not the next then (re)install the framework for that rom.
Code:
apktool if framework-res.apk
Where framework-res.apk is the one from the rom you are working with. Make sure apktool can find (the correct) framework-res.apk before you run this command.
This thread is not for apktool support.
Now, before you proceed, decode a simple app from MIUI (such as updater.apk) using apktool, do not make ANY changes, then re-encode it using apktool. For example:
Code:
apktool d Updater.apk ./decoded/
apktool b ./decoded/ new_updater.apk
Use the -v (verbose) flag in apktool if you have problems and need to diagnose further.
Remember, Android uses a case-sensitive file system, make sure your capitalisation is correct.
Typically you will not be able to install this apk because it is not signed so if you want to test the process further you can now just try step 5 below using the two apks you have.​
2. create a language directory
Assuming you can decode/encode now, this is the easy bit. For your decoded app, navigate to the directory it was decoded in, then to the /res/ directory and simply create an empty directory for your language (e.g. /values-FR/) - use international naming conventions.​
3. add the translation files
Again, not too difficult this. Download the appropriate language file for your apk from the crowdin project linked below and, using the same structure as exists in /res/values/strings.xml create a new file called strings.xml in your alternative language directory (e.g. /res/values-ES/strings.xml).
The news strings.xml may contain as many or as few translations as you like. Remember, if a translation does not exist the default value from /res/values/strings.xml will be used.
Crowdin: http://crowdin.net/project/miui-rom-translation/invite
The xml formatting and tag names need to match exactly with the default strings.xml in /res/values although the translated file does NOT need to be complete.
It is worth remembering here that unless your source apk is already translated to English then some of the default values in /res/values/strings.xml will still be in Chinese, it would pay to check these.​
4. recompile the strings
Now, if you've done everything carefully and correctly this step is really easy, all you need to do is recompile the apk with apktool using the b (for Build) switch.
Code:
apktool b ./<decoded_apk_dir>/ <output_apk_name>.apk
If this throws errors or does not work then use the -v switch to turn on verbose mode and diagnose your problem. If you did the test in step #1 and it worked then any problem at this step is likely related to your news strings.xml. Back out the changes one by one until you have found the problem and try again.
If you simply can't get it to compile with your changes then try just making a single change to the default strings.xml file in /res/values and see if that works for you.
Do NOT sign the apk!​
5. add the new strings to the apk
Easy. Open your new apk with a zip program (like 7Zip for Windows) and copy out the resources.arsc file in the root directory of the apk. Now take that file and copy it into the source apk from the rom overwriting the existing one. This process replaces the strings but keeps the integrity of the signatures on the files.
You can now push the modified file to your phone, replacing the stock one, reboot and you're translated. Push the file using "adb push" or copy it into place using a root file manager, do not "install" the new apk. Make sure you put it in the correct place (replace the original) and reboot.​
Conclusion
This process will help you add languages to any app including those in the MIUI rom. Because it's a rom the strings are contained in many different apps as well as framework-res.apk. To completely translate the rom you will need to edit every apk that has strings in it.
You will need to do this every time an apk in the rom changes. If a new version is released and say launcher2.apk is changed but updater.apk is not, then you can retain your updater.apk but you'll need to re-edit your launcher2.apk.
When an app changes the default strings.xml may also change. In this case you will need to make corresponding changes to your translations.
Good luck and if you get really stuck there's lots of people in this that have achieved success and may be willing to help!
kaobiore said:
HOW TO SPEED-UP THE TRANSLATION-PROCESS:
I've created a simple application (java-based) which tries to merge orginal-froyo-translation (taken from the official repository) into the miui-value-files. (only strings.xml are currently supported).
This program is available here:
http://www.multiupload.com/HVZXDBHIVU
djmcnz said:
Mirror Link
Click to expand...
Click to collapse
How it work / what you have to do:
1) Extract the Translator.tar.gz file (windows-users use winrar or whatever) - a directory named "Tanslator" will be created.
2) Extract the strings.xml file from the miui-package you want to translate.
This can be done with the apk-tool: apktool -d Contact.apk Contact_decoded
Copy the "res/values/strings.xml" to the created "Translator"-direcory. Open that folder and rename (the previous copied) strings.xml to "untranslated.xml".
3) Copy the strings.xml from the official froyo-sources for the package and the language you want to "merge" to the "Translator"-directory and rename the string.xml-file to "translation-file-from-froyo-repo.xml".
4) Run the program. Open a command-prompt/console. Change directory into the "Translator"-Directory and run:
java Translator untranslated.xml translation-file-from-froyo-repo.xml
This will generatre a file named "translated.xml"
For some safety reasons not all string which match "by key" are merged. (Stuff wich contains characters like '<' or '%'). You probably see some warnings printed in console (with the key) that needs to be translated manually.
If you want to override this "safety-featiure". Run the app with:
java Translator untranslated.xml translation-file-from-froyo-repo.xml psycho
(psycho at the end)
Hope this helps somehow.
Click to expand...
Click to collapse
From the other thread: http://www.youtube.com/watch?v=Or-9T44Bt7M&feature=player_embedded
Is it english ready?
vegetaleb said:
Is it english ready?
Click to expand...
Click to collapse
Read rule #2
djmcnz said:
Read rule #2
Click to expand...
Click to collapse
Wow, thats was pleasant, way to slam a guy.
Did you really expect people not ask?
I ran the language file you posted above through Google Translate so we can get a better idea how the text should read... (For the people like me that don't understand Chinese )
Code:
<string name="breathing_light_color_title"> trackball color </ string>
<string name="breathing_light_color_summary"> received a new notification, tracking the ball indicator color </ string>
<string name="breathing_light_freq_title"> trackball flicker frequency </ string>
<string name="breathing_light_freq_summary"> trackball pause time between two flashes </ string>
<string name="trackball_wake_title"> trackball light up the screen </ string>
<string name="battery_settings"> power settings </ string>
<string name="battery_settings_title"> power </ string>
<string name="battery_indicator_style"> power status bar style </ string>
<string name="battery_low_level"> low battery warning value </ string>
<string name="battery_saving_rules_title"> Automatic power rules </ string>
<string name="battery_saving_rules_summary"> alert when the power is lower than the value of the operation will be applied when the </ string>
<string name="battery_auto_saving_category_general"> the page the next time all the changes will take effect when entering a low-power </ string>
<string name="battery_auto_saving"> value into the low battery warning when the automatic power saving </ string>
<string name="battery_setting_quick_entry"> power to set Quick Entry </ string>
<string name="battery_setting_quick_entry_summary"> when the low battery, the drop-down box in the status bar display the prompt, and click to enter the current settings page </ string>
<string name="battery_auto_saving_category_rule"> power rule </ string>
<string name="battery_auto_saving_rule_brightness"> reduce the screen brightness </ string>
<string name="battery_auto_saving_rule_brightness_summary"> brightness to a minimum, you can significantly reduce battery consumption </ string>
<string name="battery_auto_saving_rule_background_data"> disable the background </ string>
<string name="battery_auto_saving_rule_background_data_summary"> save power at the same time and save network traffic costs </ string>
<string name="battery_auto_saving_rule_auto_sync"> disable automatic sync </ string>
<string name="battery_auto_saving_rule_auto_sync_summary"> close contacts, messages and other account synchronization </ string>
<string name="battery_auto_saving_rule_apn"> disable the mobile network </ string>
<string name="battery_auto_saving_rule_apn_summary"> off GPRS, 3G and other data connections </ string>
<string name="battery_auto_saving_rule_wifi"> disable WiFi wireless network </ string>
<string name="battery_auto_saving_rule_wifi_summary"> can significantly reduce battery consumption </ string>
<string name="battery_auto_saving_rule_bluetooth"> disable Bluetooth </ string>
<string name="battery_auto_saving_rule_bluetooth_summary"> can significantly reduce battery consumption </ string>
<string name="battery_auto_saving_rule_gps"> disable the GPS satellite positioning </ string>
<string name="battery_auto_saving_rule_gps_summary"> prevent background programs using the GPS, power consumption </ string>
<string name="battery_auto_saving_rule_vibrate"> disable the vibration </ string>
<string name="battery_auto_saving_rule_vibrate_summary"> shock in general consumes little power, but in a time of low power consumption is to save a little bit </ string>
<string name="battery_auto_saving_rule_haptic"> disable tactile feedback </ string>
<string name="battery_auto_saving_rule_haptic_summary"> principle above </ string>
<string name="battery_auto_saving_rule_wallpaper"> disable dynamic wallpaper </ string>
<string name="battery_auto_saving_rule_wallpaper_summary"> wallpapers will consume a lot of power but also slow down the system speed </ string>
<string name="battery_auto_saving_rule_screen_time_out"> reduce screen timeout </ string>
<string name="battery_auto_saving_rule_screen_time_out_summary"> timeout to a minimum, you can reduce the battery consumption to some extent </ string>
<string name="battery_auto_saving_rule_cpu"> reduce the CPU frequency </ string>
<string name="battery_auto_saving_rule_cpu_summary"> can reduce the "cottage" lock screen when the program is produced by CPU power consumption </ string>
<string name="battery_auto_saving_category_practise"> want more power? </ string>
<string name="battery_auto_saving_practise"> saving tips </ string>
<string name="battery_auto_saving_practise_summary"> 1 usually minimize the program running in the background \ n2 unless the bright light, usually no need to use the highest brightness \ n3 sleep can be considered to set flight mode </ string>
<string name="battery_auto_saving_practise_more"> More energy saving tips to the forums> </ string>
<string name="sd_ext_memory"> A2SD </ string>
<string name="usage_type_power"> power consumption </ string>
<string name="current_ime"> the current input method </ string>
<string name="experimental_settings"> developer-specific settings, the average user to use at your own risk </ string>
<string name="experimental_category_control_title"> system control </ string>
<string name="overscroll_mode_title"> elastic default list style </ string>
<string name="menu_style_title"> menu style </ string>
<string name="experimental_category_launcher_title"> Desktop </ string>
<string name="app_icon_background_title"> enable the icon background </ string>
I'm going to work a bit on refining the language tonight.
Going to work backwards.
1) Uploading this language file in place of the Chinese language file.
2) Load up the ROM.
3) Start browsing the menus and figure out how they should read and make the text more accurate to English.
4) Make the changes needed to the language file.
djmcnz said:
all your base are belong to us
miui rom from the far east
if you've not heard about this rom yet then check out this excellent thread started by dai323 who deserves credit for bring it to our attention.
This is an excellent rom if for no other reason than it introduces the first non-cyanogenmod/carrier/manufacturer framework overhaul of android 2.2, and boy what an overhaul. It's hard to ignore the conspiracy theory that this includes leaked elements of gingerbread... The next android. Don't ask me, i have no idea...
de-odexed | themeable | ready for translation
i will pull this at the request of the devs, pm me if you wish.​
important notice
this is for advanced users only.
this is a no questions rom, you are not allowed to ask questions that you could work the answers out for yourself. Don't dare.
this is a no complaints rom, you are not allowed to complain if it does not work, breaks your phone or has sex with your sister.
please contribute to the enhancement of this rom in a constructive fashion, see the next post.
if you agree to all of the above then you may download the rom by clicking on the appropriate answer below.
yes, i deserve to use this rom | no, i'm a bit of a tool​changes from base rom
fully de-odexed
added adw.launcher
added launcherpro
added locale
added htc ime mod
updated apps2sd to 2.7.5 final
(mostly) updated gapps (including new gmail)
resigned (any recovery)
some other stuff perhaps (?)
installation
as per any other rom & remember no questions!
and if you got this far without finding the download link then you did not read the post!
md5 hash
27933619e3fa658a1db42286cd8f6c9c​
enjoy
Click to expand...
Click to collapse
where is the download link to this rom with english...?
salamandar said:
Wow, thats was pleasant, way to slam a guy.
Did you really expect people not ask?
Click to expand...
Click to collapse
In all fairness, it does say in the original post that there are no questions, and also the Title of the post says specifically that its "Ready to Translate." It hasn't been translated yet...
xghostyxjokerx said:
where is the download link to this rom with english...?
Click to expand...
Click to collapse
"Ready to Translate".... It's still in Chinese.
It's been DeODEXed, so people willing to help translate can do it much more easily.
I couldn't help but to follow the " No, I'm A Bit of a Tool" link Excellent !!!
I wish i had google translate when i was in highschool spanish sleeping. It really would have helped a lot more than my portable translator from CVS!
hahaha i liked the point when you say And if you got this far without finding the download link then you did NOT read the post.
malavan said:
hahaha i liked the point when you say And if you got this far without finding the download link then you did NOT read the post.
Click to expand...
Click to collapse
Cov niag tseejmuag tsov tom hauv nov! Xav noj quav aub diam.
@djmcnz,
seems like nobody is respecting ur post, man but i have to agree that it is very funny , the link to no i am a bit of a tool!
anyway, the reason of my post,
i saw that you didnt include modifications to the vendering_preferences for the market fix. this was just to remind you.
http://forum.xda-developers.com/showthread.php?t=689133
i can confirm that it did help improve speed greatly!
Is it english ready?
Click to expand...
Click to collapse
Then, four posts down:
where is the download link to this rom with english...?
Click to expand...
Click to collapse
Loled hard. I guess some people don't read.
EDIT: Went back to the "No, I'm A Bit of a Tool" link, this thread is hilarious.
Thanks djmcnz & Dai323. I'll have to try this guy out.
<string name="breathing_light_color_title">跟踪球颜色</string> Trackball Flash Color
<string name="breathing_light_color_summary">在收到新通知时,跟踪球指示灯的颜色</string>Color of Trackball flash when new notifications are received
<string name="breathing_light_freq_title">跟踪球闪烁频率</string>Trackball Flash Frequency
<string name="breathing_light_freq_summary">跟踪球两次闪烁之间的停顿时间</string>Interval between consecutive flashes
<string name="trackball_wake_title">轨迹球点亮屏幕</string>Trackball Wake
<string name="battery_settings">电量设置</string>Power Settings
<string name="battery_settings_title">电量</string>Power
<string name="battery_indicator_style">状态栏电量样式</string>Battery Indicator Style
<string name="battery_low_level">低电量警戒值</string>Alarm Level for Low Battery
<string name="battery_saving_rules_title">自动省电规则</string>Power Saving Mode
<string name="battery_saving_rules_summary">当电量低于警戒值时将会应用的操作</string>Settings when battery level is below alarm level
<string name="battery_auto_saving_category_general">该页面所有修改将在下一次进入低电量时生效</string>All changes made will be effected the next time power saving mode is activated
<string name="battery_auto_saving">进入低电量警戒值的时候自动省电</string>Automatic Power Saving Mode
<string name="battery_setting_quick_entry">电量设置快速入口</string>Low Power Notification
<string name="battery_setting_quick_entry_summary">当低电量时,在状态栏下拉框中显示提示,并可点击进入当前设置页面</string>Notification will be shown when battery life is low. Click notification to enter Power Settings.
<string name="battery_auto_saving_category_rule">省电规则</string>Power Saving Options
<string name="battery_auto_saving_rule_brightness">降低屏幕亮度</string>Reduce Brightness
<string name="battery_auto_saving_rule_brightness_summary">亮度减少到最低,可以大量减少电池消耗</string>Screen Brightness is set to minimum. Can drastically decrease power draw
<string name="battery_auto_saving_rule_background_data">禁用后台数据</string>Disable Background Data Transfer
<string name="battery_auto_saving_rule_background_data_summary">节省电量的同时并可以节省网络流量费用</string>Reduce power draw and data charges
<string name="battery_auto_saving_rule_auto_sync">禁用自动同步</string>Disable Sync
<string name="battery_auto_saving_rule_auto_sync_summary">关闭联系人、邮件等帐户同步</string>Disable Syncing of Contacts, Mail, etc
<string name="battery_auto_saving_rule_apn">禁用移动网络</string>Disable Mobile Data
<string name="battery_auto_saving_rule_apn_summary">关闭GPRS、3G等数据连接</string>Disable mobile networks such as GPRS and 3G
<string name="battery_auto_saving_rule_wifi">禁用WiFi无线网络</string>Disable Wifi
<string name="battery_auto_saving_rule_wifi_summary">可以大量减少电池消耗</string>Can drastically reduce power draw
<string name="battery_auto_saving_rule_bluetooth">禁用蓝牙</string>Disable Bluetooth
<string name="battery_auto_saving_rule_bluetooth_summary">可以大量减少电池消耗</string>Can drastically reduce power draw
<string name="battery_auto_saving_rule_gps">禁用GPS卫星定位</string>Disable GPS
<string name="battery_auto_saving_rule_gps_summary">可以避免后台程序使用GPS的电量消耗</string>Disable background usage of GPS
<string name="battery_auto_saving_rule_vibrate">禁用震动</string>Disable Vibrations
<string name="battery_auto_saving_rule_vibrate_summary">震动在一般情况下消耗电量不多,但是在电量低的时候能省一点是一点</string>Vibrations do not consume much power under normal usage. (I took the liberty of leaving out the last part which basically says that "But when your battery is low it helps, however minimally."
<string name="battery_auto_saving_rule_haptic">禁用触感反馈</string>Disable Haptic Feedback
<string name="battery_auto_saving_rule_haptic_summary">原理同上</string>Refer to Vibrations
<string name="battery_auto_saving_rule_wallpaper">禁用动态壁纸</string>Disable Live Wallpapers
<string name="battery_auto_saving_rule_wallpaper_summary">动态壁纸会大量消耗电量还会拖慢系统速度</string>Live Wallpapers are significant sources of power draw and may cause system lag
<string name="battery_auto_saving_rule_screen_time_out">缩短屏幕超时设置</string>Reduce Screen Timeout
<string name="battery_auto_saving_rule_screen_time_out_summary">超时设置减少到最低,可以一定程度减少电池消耗</string>Reduce screen timeout interval to minimum. May help with battery life.
<string name="battery_auto_saving_rule_cpu">降低CPU频率</string>Reduce CPU Speed (Frequency?)
<string name="battery_auto_saving_rule_cpu_summary">可以减少“山寨”程序在锁屏时产生的CPU耗电</string>May reduce power draw from rogue applications when locking the screen
<string name="battery_auto_saving_category_practise">想更省电?</string>Want to save more power? (Direct translation. May be better as "Extending your battery life"
<string name="battery_auto_saving_practise">省电小技巧</string>Tips on Maximizing Battery Life
<string name="battery_auto_saving_practise_summary">1 平时尽量减少后台运行的程序\n2 除非强光下,平时没必要使用最高亮度\n3 睡觉时可以考虑设置飞行模式</string>1.Limit number of applications that run in the background. 2.Unless under bright light, there is no need for maximum brightness. 3.Consider activating Flight Mode at night.
<string name="battery_auto_saving_practise_more">到论坛查看更多省电技巧></string>Check out more power saving tips at the forums
<string name="sd_ext_memory">A2SD+</string>A2SD+
<string name="usage_type_power">耗电量</string>Battery Use (I have no idea what this actually does, but I'm guessing a battery usage breakdown by app)
<string name="current_ime">当前输入法</string>Current Keyboard
<string name="experimental_settings">开发人员专用设置,普通用户使用后果自负</string>Developer settings only. Use at own risk.
<string name="experimental_category_control_title">系统控件</string>System Controls
<string name="overscroll_mode_title">列表弹性缺省风格</string>Lists Overshoot
<string name="menu_style_title">菜单风格</string>Menu Styles
<string name="experimental_category_launcher_title">桌面</string>Homescreen (Launcher may work better here, I'd need to actually see what it does first)
<string name="app_icon_background_title">启用图标背景</string>Icon Backgrounds on Homescreen
Click to expand...
Click to collapse
I take it that you wanted these translated!
I have no experience with actually working with Android ROMs, however, so this is as far as I can go. But I'd be happy to translate others if someone posts them.
Edit: Ninja'd by Google Translate while I was working on this. I have to say I'm pretty darn impressed by the accuracy of Google Translate now, as opposed to like a year ago when it just spews out random crap.
djmcnz said:
...or has sex with your sister.
Click to expand...
Click to collapse
That'd be the only way she'd get a date...
Another great kang . Should be called 'miui-kang'
Has anyone verified darktremor a2sd works ?
Also are the trackball led alerts configurable?
(yes I dare!!)
hooray for the "enable the icon background" option
britoso said:
Another great kang . Should be called 'miui-kang'
Has anyone verified darktremor a2sd works ?
Also are the trackball led alerts configurable?
Click to expand...
Click to collapse
DT a2sd was included in the original Miui rom, so yeah it works.
Configurable alerts have no idea about

[APP][ROOT] zTorch Adjustable and extremely bright Flashlight

EDIT: 11/15/2014
This post features version 2.x.x. It is a complete rewrite using Android Studio because importing the project from Eclipse didn't go too well.
For information on version 1.x.x , go to post #28
Downloads for both versions are at the bottom of this page.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
ZTORCH Features:
The goal of ZTorch is to be a extremely quick and lightweight app that does one thing and does it well without extra bloat or ridiculous permissions. ZTorch can vary the brightness of your phones LED and allow you to set brightness levels higher than possible anywhere else.
The Galaxy S4 is capable of 16 different levels of brightness (0-15). Compared to other Apps:
The stock "Assistive Light" that is featured with the phone only sets the level to 1.
The brightest AppStore Apps, such as TeslaLED, are able to set the brightness to a little less than half brightness, level 6.
Typically, flashlight apps take about a second to switch on the LED
ZTorch can adjust the LED in mere milliseconds.
ZTorch stays on when the screen is off and doesn't flicker when the screen switches off.
ZTorch works with the camera. Ever wanted to use the flashlight LED while recording a video or taking a picture? Now you can.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
ZTorch should work across all phones with root if the proper system file is on the phone. ZTorch scans for the following binaries below. If your device isn't supported and you know the path to the proper file, you can set that path in the apps preferences. This app has only ever been tested on the Galaxy S4, if you try it on a different phone, PLEASE let me know how it is!
Code:
"/sys/class/camera/flash/rear_flash", - For Galaxy s4
"/sys/class/camera/rear/rear_flash", - For Galaxy Note and maybe s3
"/sys/class/leds/flashlight/brightness," - HTC devices
"/sys/devices/platform/flashlight.0/leds/flashlight/brightness" - HTC devices
" /sys/class/leds/spotlight/brightness" - Motorolla Droid Devices
"/sys/class/leds/torch-flash/flash_light" - Motorolla Droid 2
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Screenshots from ZTORCH-beta-2.0.0.26.apk:
Main Activity as popup with widget shown in background.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Notification:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Permissions:
ACCESS_SUPERUSER - To set the LED
RECEIVE_BOOT_COMPLETED - Sets LED to 0, allows for persistent notification, notification on bootup.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Version Information:
Download attached at bottom of post.
LATEST: Version 2.0.3.50: (Feb 24, 2015)
Notification now appears on boot if that setting is enabled
Separated BootReceiver from main broadcast receiver so disabling the boot receiver won't break the rest of the app.
Notification icon changed to support Lollipop.
Renamed some app refs.
Somehow cut 50kb from the app, it's now 100.6Kb. Considering the Icons take up 89.5Kb I'm kinda amazed.
I haven't got around to making an actual Settings activity. So features are the same from prior version.
Version 1.2.2: (Mar 3, 2014) All the features work but is less refined.
Version 1.3.0: (June 16,2014) Added TorchPlayer to act similar to PWM. All Features work.
Version 1.4.0 (June 20,2014) Switching speed was the priority in this version; the brightness can be changed in <3ms. I abandoned the very comprehensive and powerful Stericson RootTools library in favor of a purpose built class that toggles the flashlight. Warning: The notification doesn't work on API-19 Android 4.4+. Clicking it does nothing. I need to build a new version sometime.
For more info on version 1.x.x such as the screenshots, see post #28
ZTORCH-beta-2.0.0.28: (November 15,2014) Beta version does not yet have a settings or preference activity implemented as well as other nonessentials. To change settings in this version, see below. Changes include:
Entirely new MainActivity that's now in a Popup window
Entirely New and Fully Working Notification
Widget now fills the entire 1x1 grid. (Let me know if there's problems, I set the left and right margins to -23dp to do this)
Added Warn feature and Torch Fireball icon for when the brightness is higher than the Warn value.
Slider no longer lags while trying to effectively "make a strobe light" by not sending broadcasts, updating views, or saving the brightness until after you take your finger off.
Slider changes color based on level.
ZTORCH-beta-2.0.0.33optimized: Technically should be: 2.0.2.33(November 16,2014) Changes:
Adds RECEIVE_BOOT_COMPLETE permission.
Ongoing Notification is available in AppPrefs.xml
TapGuard enabled by default. (Widget ignores first tap to prevent accidental taps)
ZTORCH-optimizedbeta-2.0.3.41: (November 17,2014) Changes:
New Notification AppPrefs.
ongoingNotif (Can't swipe away, Persistent).
onPriority and offPriority (levels: -2, -1, 0, 1, 2 where 2 is PRIORITY_MAX)
Shell Command Text and Toggle Button updated instantly while slider moves.
ZTorchReceiver enables you to send commands from other apps such as Tasker. Available broadcasts listed further down.
Fixed Force Close if the Main Toggle button is pressed and root was denied or the device is unsupported. (Not like you can use the app like this anyway, but still)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
BETA Version Settings
I'm still trying to figure out how android implements preferences and preference fragments. So in the beta, there is none! To change a setting, get a file browser with root access such as ES File Explorer, then navigate to the location below and edit the file "LEDPrefs.xml"
Code:
/data/data/derekziemba.ztorch/shared_prefs/
Additionally there is another file, "AppPrefs.xml" where you will find app specific settings and be able to configure the Notification.
"LEDPrefs.xml" will look like this on ZTORCH-beta-2.0.0.28. Later versions will be slightly different. I recommend uninstalling the app before installing a new beta.
default - The value the torch will turn on at when Toggled or Enabled.
inc - increment. Value the notifications "+" and "-" will increase or decrease by and the Widget will increase at if multitap = true;
multitap - If true, on successive widget taps the brightness will increase by the inc value. If false, brightness will toggle to default value;
wait - For multitap and tapguard. Time in milliseconds between successive widget taps to increase brightness. If more time than this has passed, the LED will shut off.
tapguard - To prevent accidental widget taps turning on the LED. If true, the widget ignores the first tap and waits for a second tap, unless the LED is already on.
min - just leave at 0, this is the "off" value, it is here in case some phones are reversed
max - maximum value on slider and the max value you can increment to. Only the first 3 digits of this will ever be used, giving a max possible value of 999.
warn - value at which the torch turns from yellow to a fireball and the slider begins changing colors from blue to yellow to red.
lvl - Current Brightness. There is no way to retrieve the current LED level, so the last value is stored here
sys - the system binary that controls the LED;
mask - bitmask. The brightness level is bitwise AND'ed with this value before executing the shell command to prevent invalid values. If you need help configuring this, use windows calculator and set it to programmer mode on Integer then click the bits you want to use, then use the integer value given.
"AppPrefs.xml" settings:
enableTorchOnAppLaunch - If true, opening the app will automatically set the brightness to the default value listed in "LEDPrefs.xml". Default is "false"
persistentNotif - If true, the notification will be persistent and it cannot be swiped away. Default is "false"
showNotifOnBootComplete - Posts the notification when BOOT_COMPLETE is received for easy access. Use with persistentNotif to prevent swiping away. Default is "true"
Notification Priorities. There are 5: MIN(-2), LOW(-1), DEFAULT(0), HIGH(1), and MAX(2). More info here: http://developer.android.com/design/patterns/notifications.html#guidelines
notifPriorityTorchON - Notification Priority when the LED is on. Default is "2"
notifPriorityTorchOFF - Notification Priority when the LED is off. Default is "-1". Versions before 2.0.3.41 including 1.x.x are hardcoded at "-2"
Important: Before changing any settings, be sure to kill ZTorch with a task manager. Otherwise the settings will not take effect and they will be overwritten when the app gets sent to the background.
If you mess up the settings ZTorch will force close on launch. Delete the XML file to restore defaults.
Strobe Light:
You can get some pretty cool stobbing effects by changing the "mask" and "max" settings.
If you set the "max" value to something like 200 with the mask set to 15 (0000-1111), when sliding the slidebar from 0 to 200, the actual brightness set will repeat 0-15 over and over.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Setting Brightness from other apps such as Tasker, using ZTorch's BroadcastReceiver
I still have to test if this works, but in theory it should. The ZTorchReceiver supports the actions below.
Code:
"derekziemba.ztorch.UPDATE_LEVEL"; //Service will check for extra Integer under the key "lvl" and set that brightness if it is valid.
"derekziemba.ztorch.WIDGET_TAP"; //Behave as if the widget was just tapped. MultiTap, TapGuard, and Wait apply.
"derekziemba.ztorch.STEP_UP"; //Increment Brightness by increment value
"derekziemba.ztorch.STEP_DOWN"; //Decrement Brightness by increment value
"derekziemba.ztorch.INCREASE"; //Increase Brightness by 1
"derekziemba.ztorch.DECREASE"; //Decrease Brightness by 1
"derekziemba.ztorch.ENABLE"; //Turn on torch at default level
"derekziemba.ztorch.DISABLE"; //Turn off torch
"derekziemba.ztorch.TOGGLE"; //Toggle the torch opposite its current state.
---------------------------------Internal---------------------------
"derekziemba.ztorch.UPDATE_FROM_MAIN"; //From main activity, prevents service from broadcasting UPDATE_FROM_SERVICE and cause an endless loop. Contains extra Integer under key "lvl"
"derekziemba.ztorch.UPDATE_FROM_SERVICE"; //Sent from the Service to Main, this one is Unregistered when Main is not visible. It is still sent by the service.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Important Note Regarding Brightness:
For default settings I have the max LED value set to 13 because I've experienced flicker. Values higher than 10 change the color of the slider to red and the widget and notification flame from yellow to fireball. Flicker occurs when your battery voltage is to low to support the current level of brightness.
To avoid LED flicker:
>3800+mV or ~50% is needed for Levels >=13.
> 3750mV or ~30% is needed for Levels > 9.
> 3600mV or ~10% is needed for Levels > 7.
I have used my app to work several hours in an attic at brightness 11. I used my phone because it's actually significantly brighter than every flashlight I own. That includes a flashlight with a 6V cell, a 3 LED headlamp, and a 4 battery AAA LED flashlight. My only light that beat it was my spotlight, but the spotlight's beam is too focused whereas the phone lights up everything.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note: Android displays the build version as 1 higher than the file name. So Android will show version 2.0.3.41 as 2.0.3.42. This is caused by some Gradle Build Config bug.
I use the torch a lot so I just downloaded this and I'll definitely let you know how it goes. Thanks!
Verizon S4
Liquid Smooth 4.4
Sprint S4
Negalite 4.4
Great app. Been using it for a few days with no issues. Love the incremental increases/decreases.
Anyway to get this to stay in the notification drop down?
Sent from my SCH-I545 using Tapatalk 2
rahilkalim said:
Great app. Been using it for a few days with no issues. Love the incremental increases/decreases.
Anyway to get this to stay in the notification drop down?
Sent from my SCH-I545 using Tapatalk 2
Click to expand...
Click to collapse
I might be able to implement that as a setting quick when I get home. And maybe add an option to make it half height too if it's going to be persistent.
DerekZ10 said:
I might be able to implement that as a setting quick when I get home. And maybe add an option to make it half height too if it's going to be persistent.
Click to expand...
Click to collapse
That would be great. Thanks.
Sent from my SCH-I545 using Tapatalk 2
rahilkalim said:
That would be great. Thanks.
Sent from my SCH-I545 using Tapatalk 2
Click to expand...
Click to collapse
Just updated it. Here's what's new:
Settings Activity has had a makeover. The question mark on the side will explain what the settings do. The image on the left shows what it looks like if the Persistent Notification and the Minimizing Notification toggles are enabled. The right shows what it looks like with the Minimizing Notification toggle off. Notice that when the Minimizing Notification toggle is disabled, zTorch's icon is in the notification bar.
Here is what zTorch looks like in the notification drop down with minimization enabled. The left screenshot is with zTorch minimized. In this state the icon is not in the notification bar. The screenshot ion the right shows the notification expanded with the minimize option enabled, In this state the icon will show up in the notification bar.
Disabling Notification minimization but keeping Persistent notification enabled will cause the notification to appear like the left and middle screenshots. When the Torch is off, only an Activate LED button is present. If there are a large number of other notification, the notification will shrink up. With the Torch on more buttons become available as seen in the middle screenshot. The rightmost screenshot is the notification with both the persistent notification and notification minimization disabled.
Note: This version 1.2.0 has some rough edges. I'll polish it when I have more time. In the future the Settings activity will also be changed to an actual Android Settings layout instead of a generic layout.
EDIT: Version 1.2.1 rounds out those edges.
Now that school is out, I'll be updating and posting the source code on github soon
DerekZ10 said:
Now that school is out, I'll be updating and posting the source code on github soon
Click to expand...
Click to collapse
Great job, works great!
This looks great. Do you have any plans to update this for nc5 4.4.2 compatibility?
Sent from my SCH-I545 using Tapatalk
klabit87 said:
This looks great. Do you have any plans to update this for nc5 4.4.2 compatibility?
Sent from my SCH-I545 using Tapatalk
Click to expand...
Click to collapse
This is why I wanna get the source code up. So others can compile it for their versions. I'm running Android 4.2.2 Eclipse 2.0 Rom. It's all customized and set up the way I like, and it's been very reliable. I'm not sure when I will get around to upgrading. Every rom I have tried as a replacement has had problems.
I haven't got around to posting the source code because there was suddenly some issues with the build? I opened the project the other day and was told I needed to upgrade things, I did and now every object and include directive is underlined in red. I looked at it for about a minute before deciding I'll figure it out some other day. Haven't got around to it since.
Oh ok. I was just wondering. Looking forward to the source so we can have it work for updated android versions someday.
Thanks.
Sent from my SCH-I545 using Tapatalk
klabit87 said:
Oh ok. I was just wondering. Looking forward to the source so we can have it work for updated android versions someday.
Thanks.
Sent from my SCH-I545 using Tapatalk
Click to expand...
Click to collapse
Here's the Source Code Everyone, Good Luck! Everything for the project should be on GitHub including external libraries and the .psd files for the icons.
https://github.com/DerekZiemba/zTorch
I haven't been able to build this or other projects since upgrading the SDK and the Eclipse ADT. I'm not getting any errors, I just get "export build failed." Not sure what to do, maybe reinstall everything. Hopefully someone here can get it working. I just really don't have enough time. In fact the whole project was born out of procrastinating a huge report I didn't want to do for school.
I have everything working again and the source code should build the most stable recent version. The 1.3 beta version is on my dropbox now. This version is a work in progress and the new TorchPlayer feature is not in a working state, but everything else works as usual.
I'm releasing this build before this new feature is working so people with newer versions of android can use the apps pre-existing features.
Here is basically what TorchPlayer is and how it will effect the app in future versions:
Once working properly it will be used to define increment steps for things such as rapid-tap and consecutive-tap (currently double-tap). The time element of these steps will define the max time the LED will stay lit before (likely) dropping down a step. It will be a way to prevent the LED being lit in your pocket all day and limiting the max LED brightness to a defined time.
TorchPlayer will eventually allow you to name and save sequences and have a repeat mode so you can use it as a strobe light. I'm not sure yet how fast the LED can be switched on and off. I might also look into having the sequence controlled by Morse code using dots and dashes.
For this to work I have to figure out, basically, multi-threading(handlers, runnables, threads) and a few other things such as Gson or SQLite.
NOTE: Installing this version messed up my widget. If it happens to you just delete it and re add it to fix.
Shown below is version 1.3 beta 4. I've found that I can strobe the led light ridiculously fast. I haven't encountered the limit yet at even the 5 millisecond intervals. At 5millis the LED is flashing so fast that it is almost becoming steady. With this it may be possible to set custom "LightTones" for certain things like you do with ring tones.
EDIT:
Beta 5 added ability to duplicate several values to save on typing as seen below: Also note, the parenthesis and spaces don't actually matter and are only there to make it easier on me to read. The input is sanitized using: String scheme = behavior.replaceAll("[^0-9/sm,.*&]+",""); So only numbers, the letters s and m, and the symbols / , . * & matter. If a brightness value is out of range that command is ignored.
Here is a video of what the above TorchPlayer string yields.
https://www.youtube.com/watch?v=c1lwTHZwr-M&feature=youtu.be
DerekZ10 said:
I have everything working again and the source code should build the most stable recent version. The 1.3 beta version is on my dropbox now. This version is a work in progress and the new TorchPlayer feature is not in a working state, but everything else works as usual.
I'm releasing this build before this new feature is working so people with newer versions of android can use the apps pre-existing features.
Here is basically what TorchPlayer is and how it will effect the app in future versions:
Once working properly it will be used to define increment steps for things such as rapid-tap and consecutive-tap (currently double-tap). The time element of these steps will define the max time the LED will stay lit before (likely) dropping down a step. It will be a way to prevent the LED being lit in your pocket all day and limiting the max LED brightness to a defined time.
TorchPlayer will eventually allow you to name and save sequences and have a repeat mode so you can use it as a strobe light. I'm not sure yet how fast the LED can be switched on and off. I might also look into having the sequence controlled by Morse code using dots and dashes.
For this to work I have to figure out, basically, multi-threading(handlers, runnables, threads) and a few other things such as Gson or SQLite.
NOTE: Installing this version messed up my widget. If it happens to you just delete it and re add it to fix.
Click to expand...
Click to collapse
For some reason the toggle doesn't show in my drop down now, any ideas?
shindiggity said:
For some reason the toggle doesn't show in my drop down now, any ideas?
Click to expand...
Click to collapse
Just confirmed it is a bug. To get the notification to show you need to switch the torch on once. It'll stay in the dropdown after.
I'll try to get a new build together soon. I learned a few things about Android the other day that made me realize my code was overly complicated and difficult to work with, much more so than it ever needed to be. So I actually started a total rewrite since that version that I want to get perfect.
The new version is a different app all together, the system and launcher will see it as zTorch-L. The L stands for it really being the "Lite" version, in app it will refer to it self as zTorch-Lightning. I decided that the TorchPlayer feature went against the whole purpose of making my own app in the first place. I created it to be fast, simple, no-bs or bugs, do one thing and do it well. What I wanted out of TorchPlayer would cause the app to loose focus of its goal, so I started this new version that would be just that.
Because I want it to be totally finished before releasing, I'm not going to post a link to it here. The code wouldn't even compile if I tried. But if you really rely on the notification being in the dropdown PM me. I have an alpha version I compiled before going to far in to rewriting the code. Everything works great AFTER some tweaking first.
Initially it is inoperable unless, starting from the root directory, you navigate to the following file:
Code:
/data/data/derekziemba.ztorchL/shared_prefs/derekziemba.ztorchL_preferences.xml
Open it, delete what ever is in it, then paste the below text :
Code:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<int name="flash_current_value" value="0" />
<int name="tap_time" value="900" />
<int name="brightness_increment_steps" value="3" />
<int name="default_value" value="8" />
<int name="flash_limit_value" value="13" />
<boolean name="rapid_tap" value="true" />
<boolean name="persistent_notif" value="true" />
<boolean name="mini_notif" value="true" />
</map>
I sent you a PM, be happy too.
DerekZ10 said:
Just confirmed it is a bug. To get the notification to show you need to switch the torch on once. It'll stay in the dropdown after.
I'll try to get a new build together soon. I learned a few things about Android the other day that made me realize my code was overly complicated and difficult to work with, much more so than it ever needed to be. So I actually started a total rewrite since that version that I want to get perfect.
The new version is a different app all together, the system and launcher will see it as zTorch-L. The L stands for it really being the "Lite" version, in app it will refer to it self as zTorch-Lightning. I decided that the TorchPlayer feature went against the whole purpose of making my own app in the first place. I created it to be fast, simple, no-bs or bugs, do one thing and do it well. What I wanted out of TorchPlayer would cause the app to loose focus of its goal, so I started this new version that would be just that.
Because I want it to be totally finished before releasing, I'm not going to post a link to it here. The code wouldn't even compile if I tried. But if you really rely on the notification being in the dropdown PM me. I have an alpha version I compiled before going to far in to rewriting the code. Everything works great AFTER some tweaking first.
Initially it is inoperable unless, starting from the root directory, you navigate to the following file:
Code:
/data/data/derekziemba.ztorchL/shared_prefs/derekziemba.ztorchL_preferences.xml
Open it, delete what ever is in it, then paste the below text :
Code:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<int name="flash_current_value" value="0" />
<int name="tap_time" value="900" />
<int name="brightness_increment_steps" value="3" />
<int name="default_value" value="8" />
<int name="flash_limit_value" value="13" />
<boolean name="rapid_tap" value="true" />
<boolean name="persistent_notif" value="true" />
<boolean name="mini_notif" value="true" />
</map>
Click to expand...
Click to collapse
shindiggity said:
I sent you a PM, be happy too.
Click to expand...
Click to collapse
So you guys don't have to keep using that version if you don't want to, try the zTorch-Lightning_v1.Alpha2 . There's a lot of stuff to do yet, but all the basics are working.
You'll notice the notification is way more responsive and that it no longer does that thing "refresh flash" when switching to different notification styles. It responds instantly to setting changes now too.
When tapping the 1x1 incremental widget, the LED is now set to turn on before the system broadcast and before the on screen widget lights up instead of the other way around.
http://db.orangedox.com/FBzt4wNNfVu1xIMc0W/zTorch-Lightning_v1.Alpha2.apk
This is just what i have been looking for!! So what kind of licensing is your code on git under?
Adjustable flash brightness is just what i want to look adding to my Camera app. I need something lower intensity than the stock.
Unfortunately, I am unable to test this app as my rooted devices don't have flash.
hotspot_volcano said:
This is just what i have been looking for!! So what kind of licensing is your code on git under?
Adjustable flash brightness is just what i want to look adding to my Camera app. I need something lower intensity than the stock.
Unfortunately, I am unable to test this app as my rooted devices don't have flash.
Click to expand...
Click to collapse
Free to use as long as you don't repackage it as is but with ads or put a price on the app. However if you are creating your own app and just want to use the flashlight feature, you can use the below code however you want. I think the git code is way out of date, I worked on it a bit a while ago and I don't think I comited it. I've gotten busy and haven't had a chance to work on it in months.
Here is the code for directly changing the brightness. Free to Use however you wish.
Here is the Shell Class. The Static Methods create and maintain the superuser shell. Therefor a command can be executed app wide on a single shell instead of creating multiple Shell instances.
Code:
package derekziemba.misc;
import java.io.*;
public class Shell {
private static Shell rootShell = null;
private final Process proc;
private final OutputStreamWriter writer;
private Shell() throws IOException {//Open with Root Privileges
this.proc = new ProcessBuilder("su").redirectErrorStream(true).start();
this.writer = new OutputStreamWriter(this.proc.getOutputStream(), "UTF-8");
}
private void cmd(String command) {
try{ writer.write(command+'\n'); writer.flush();}
catch(IOException e) { }
}
public void close() {
try {
if (writer != null) { writer.close();
if(proc != null) { proc.destroy(); }
}
} catch (IOException ignore) {}
}
public static void exec(String command) { Shell.get().cmd(command); }
public static Shell get() {
if (rootShell == null) {
while (rootShell == null) {
try { rootShell = new Shell(); }
catch (IOException e) { }
}
}
return rootShell;
}
}
}
Here is what is used for setting the flash brightness. I stripped out all the app logic. SetLevelCovertly is the actual method used for setting the brightness. It is what the TorchPlayer uses to directly change the brightness in just milliseconds. The stripped away normal SetLevel method records the brightness, triggers the broadcasts, sets the widgets, and fires the notification. There is no way of getting the current flashlevel brightness since my Shell implementation is just for blasting commands at the terminal. Anything more will slow it down.
The listOfFlashFiles is a bunch of different files different phones may use. I've only ever tested the samsung file.
Code:
import java.io.File;
import derekziemba.misc.Shell;
public class Torch
{
private static String FLASH_FILE = null;
private static final String[] listOfFlashFiles = {
"/sys/class/camera/flash/rear_flash",
"/sys/class/camera/rear/rear_flash",
"/sys/class/leds/flashlight/brightness",
"/sys/devices/platform/flashlight.0/leds/flashlight/brightness",
"/sys/class/leds/spotlight/brightness",
"/sys/class/leds/torch-flash/flash_light"
};
/**
* Bypasses all checks and settings and just sets the value. The app will not know what the level is because it is not recorded.
* Will not trigger broadcast, widget views, notification
*/
public static void setLevelCovertly(int value) { Shell.exec("echo " + value + " > "+ getSysFsFile()); }
public static String getSysFsFile() {
if (FLASH_FILE != null) return FLASH_FILE;
for (String filePath : listOfFlashFiles) {
File flashFile = new File(filePath);
if (flashFile.exists()) { FLASH_FILE = filePath; }
}
return FLASH_FILE;
}

What is Motivation Description?

How to make your app accessible to users with vision impairment or other physical disabilities.
Your customer base probably includes many people with disabilities, whether you are aware of it or not. According to government figures, one person in five has some functional limitation, and eight percent of all users on the Web have disabilities. In the United States alone there are more than 30 million people with disabilities who can be affected by the design of computer software, and worldwide the number is much higher. Many countries/regions, including the United States, have laws that mandate accessibility at some level.
When it comes to reaching as wide a user base as possible, it's important to pay attention to accessibility in your Android application. Cues in your user interface that may work for a majority of users, such as a visible change in state when a button is pressed, can be less optimal if the user is visually impaired.
This post shows you how to make the most of the accessibility features built into the Android framework. It covers how to optimize your app for accessibility, leveraging platform features like focus navigation and content descriptions. It also covers how to build accessibility services, that can facilitate user interaction with any Android application, not just your own.
Techniques should be applied to solve them:
1. Developing Accessible Applications
Learn to make your Android application accessible. Allow for easy navigation with a keyboard or directional pad, set labels and fire events that can be interpreted by an accessibility service to facilitate a smooth user experience.
Add Content Descriptions
It's easy to add labels to UI elements in your application that can be read out loud to your user by a speech-based accessibility service like TalkBack . If you have a label that's likely not to change during the lifecycle of the application (such as "Pause" or "Purchase"), you can add it via the XML layout, by setting a UI element's android:contentDescription attribute, like in this example:
<Button
android:id=”@+id/pause_button”
android:src=”@drawable/pause”
android:contentDescription=”@string/pause”/>
However, there are plenty of situations where it's desirable to base the content description on some context, such as the state of a toggle button, or a piece selectable data like a list item. To edit the content description at runtime, use the setContentDescription() method, like this:
String contentDescription = "Select " + strValues[position];
label.setContentDescription(contentDescription);
Try to add content descriptions wherever there's useful information, but avoid the web-developer pitfall of labelling everything with useless information. For instance, don't set an application icon's content description to "app icon". That just increases the noise a user needs to navigate in order to pull useful information from your interface.
Try it out! Download TalkBack (an accessibility service published by Google) and enable it in Settings > Accessibility > TalkBack. Then navigate around your own application and listen for the audible cues provided by TalkBack.
Design for Focus Navigation
Your application should support more methods of navigation than the touch screen alone. Many Android devices come with navigation hardware other than the touchscreen, like a D-Pad, arrow keys, or a trackball. In addition, later Android releases also support connecting external devices like keyboards via USB or bluetooth.
In order to enable this form of navigation, all navigational elements that the user should be able to navigate to need to be set as focusable. This modification can be done at runtime using the View.setFocusable() method on that UI control, or by setting the android:focusable attrubute in your XML layout files.
Also, each UI control has 4 attributes, android:nextFocusUp, android:nextFocusDown, android:nextFocusLeft, and android:nextFocusRight, which you can use to designate the next view to receive focus when the user navigates in that direction. While the platform determines navigation sequences automatically based on layout proximity, you can use these attributes to override that sequence if it isn't appropriate in your application.
For instance, here's how you represent a button and label, both focusable, such that pressing down takes you from the button to the text view, and pressing up would take you back to the button.
<Button android:id="@+id/doSomething"
android:focusable="true"
android:nextFocusDown=”@id/label”
... />
<TextView android:id="@+id/label"
android:focusable=”true”
android:text="@string/labelText"
android:nextFocusUp=”@id/doSomething”
... />
Fire Accessibility Events
If you write a custom view, make sure it fires events at the appropriate times. Generate events by calling sendAccessibilityEvent(int), with a parameter representing the type of event that occurred. A complete list of the event types currently supported can be found in the AccessibilityEvent reference documentation.
As an example, if you want to extend an image view such that you can write captions by typing on the keyboard when it has focus, it makes sense to fire an TYPE_VIEW_TEXT_CHANGED event, even though that's not normally built into image views. The code to generate that event would look like this:
public void onTextChanged(String before, String after) {
...
if (AccessibilityManager.getInstance(mContext).isEnabled()) {
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
}
...
}
Test Your Application
Be sure to test the accessibility functionality as you add it to your application. In order to test the content descriptions and Accessibility events, install and enable an accessibility service. One option is Talkback , a free, open source screen reader available on Google Play. With the service enabled, test all the navigation flows through your application and listen to the spoken feedback.
2. Developing Accessibility Services
Develop an accessibility service that listens for accessibility events, mines those events for information like event type and content descriptions, and uses that information to communicate with the user. The example will use a text-to-speech engine to speak to the user.
Create Your Accessibility Service
An accessibility service can be bundled with a normal application, or created as a standalone Android project. The steps to creating the service are the same in either situation. Within your project, create a class that extends AccessibilityService.
package com.example.android.apis.accessibility;
import android.accessibilityservice.AccessibilityService;
public class MyAccessibilityService extends AccessibilityService {
...
@override
public void onAccessibilityEvent(AccessibilityEvent event) {
}
@override
public void onInterrupt() {
}
...
}
Like any other service, you also declare it in the manifest file. Remember to specify that it handles the android.accessibilityservice intent, so that the service is called when applications fire an AccessibilityEvent.
<application ...>
...
<service android:name=".MyAccessibilityService">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
. . .
</service>
...
</application>
If you created a new project for this service, and don't plan on having an application, you can remove the starter Activity class (usually called MainActivity.java) from your source. Remember to also remove the corresponding activity element from your manifest.
Configure Your Accessibility Service
You have two options for how to set these variables. The backwards-compatible option is to set them in code, using setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo). To do that, override the onServiceConnected() method and configure your service in there. @override
public void onServiceConnected() {
// Set the type of events that this service wants to listen to. Others
// won't be passed to this service.
info.eventTypes = AccessibilityEvent.TYPE_VIEW_CLICKED |
AccessibilityEvent.TYPE_VIEW_FOCUSED;
// If you only want this service to work with specific applications, set their
// package names here. Otherwise, when the service is activated, it will listen
// to events from all applications.
info.packageNames = new String[]
{"com.example.android.myFirstApp", "com.example.android.mySecondApp"};
// Set the type of feedback your service will provide.
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
// Default services are invoked only if no package-specific ones are present
// for the type of AccessibilityEvent generated. This service *is*
// application-specific, so the flag isn't necessary. If this was a
// general-purpose service, it would be worth considering setting the
// DEFAULT flag.
// info.flags = AccessibilityServiceInfo.DEFAULT;
info.notificationTimeout = 100;
this.setServiceInfo(info);
}
The second option is to configure the service using an XML file. Certain configuration options like canRetrieveWindowContent are only available if you configure your service using XML. The same configuration options above, defined using XML, would look like this:
<accessibility-service
android: accessibilityEventTypes="typeViewClicked|typeViewFocused"
android: packageNames="com.example.android.myFirstApp, com.example.android.mySecondApp"
android: accessibilityFeedbackType="feedbackSpoken"
android: notificationTimeout="100"
android: settingsActivity="com.example.android.apis.accessibility.TestBackActivity"
android: canRetrieveWindowContent="true"
/>
If you go the XML route, be sure to reference it in your manifest, by adding a <meta-data> tag to your service declaration, pointing at the XML file. If you stored your XML file in res/xml/serviceconfig.xml, the new tag would look like this:
<service android:name=".MyAccessibilityService">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data android:name="android.accessibilityservice"
android:resource="@xml/serviceconfig" />
</service>
Respond to AccessibilityEvents
Now that your service is set up to run and listen for events, write some code so it knows what to do when an AccessibilityEvent actually arrives! Start by overriding the onAccessibilityEvent(AccessibilityEvent) method. In that method, use getEventType() to determine the type of event, and getContentDescription() to extract any label text associated with the view that fired the event. @override
public void onAccessibilityEvent(AccessibilityEvent event) {
final int eventType = event.getEventType();
String eventText = null;
switch(eventType) {
case AccessibilityEvent.TYPE_VIEW_CLICKED:
eventText = "Focused: ";
break;
case AccessibilityEvent.TYPE_VIEW_FOCUSED:
eventText = "Focused: ";
break;
}
eventText = eventText + event.getContentDescription();
// Do something nifty with this text, like speak the composed string
// back to the user.
speakToUser(eventText);
...
}
Query the View Heirarchy for More Context
This step is optional, but highly useful. The Android platform provides the ability for an AccessibilityService to query the view hierarchy, collecting information about the UI component that generated an event, and its parent and children. In order to do this, make sure that you set the following line in your XML configuration:
android:canRetrieveWindowContent="true"
Once that's done, get an AccessibilityNodeInfo object using getSource(). This call only returns an object if the window where the event originated is still the active window. If not, it will return null, so behave accordingly. The following example is a snippet of code that, when it receives an event, does the following:
.Immediately grab the parent of the view where the event originated
.In that view, look for a label and a check box as children views
.If it finds them, create a string to report to the user, indicating the label and whether it was checked or not.
.If at any point a null value is returned while traversing the view hierarchy, the method quietly gives up.
// Alternative onAccessibilityEvent, that uses AccessibilityNodeInfo @override
public void onAccessibilityEvent(AccessibilityEvent event) {
AccessibilityNodeInfo source = event.getSource();
if (source == null) {
return;
}
// Grab the parent of the view that fired the event.
AccessibilityNodeInfo rowNode = getListItemNodeInfo(source);
if (rowNode == null) {
return;
}
// Using this parent, get references to both child nodes, the label and the checkbox.
AccessibilityNodeInfo labelNode = rowNode.getChild(0);
if (labelNode == null) {
rowNode.recycle();
return;
}
AccessibilityNodeInfo completeNode = rowNode.getChild(1);
if (completeNode == null) {
rowNode.recycle();
return;
}
// Determine what the task is and whether or not it's complete, based on
// the text inside the label, and the state of the check-box.
if (rowNode.getChildCount() < 2 || !rowNode.getChild(1).isCheckable()) {
rowNode.recycle();
return;
}
CharSequence taskLabel = labelNode.getText();
final boolean isComplete = completeNode.isChecked();
String completeStr = null;
if (isComplete) {
completeStr = getString(R.string.checked);
} else {
completeStr = getString(R.string.not_checked);
}
String reportStr = taskLabel + completeStr;
speakToUser(reportStr);
}
Now you have a complete, functioning accessibility service. Try configuring how it interacts with the user, by adding Android's text-to-speech engine, or using a Vibrator to provide haptic feedback!
3. Accessibility Checklist
Learn how to test your app for accessibility.
Testing Accessibility Features
Testing of accessibility features such as TalkBack, Explore by Touch and accessibility Gestures requires setup of your testing device. This section describes how to enable these features for accessibility testing.
Testing audible feedback
Audible accessibility feedback features on Android devices provide audio prompts that speaks the screen content as you move around an application. By enabling these features on an Android device, you can test the experience of users with blindness or low-vision using your application.
Audible feedback for users on Android is typically provided by TalkBack accessibility service and the Explore by Touch system feature. The TalkBack accessibility service comes preinstalled on most Android devices and can also be downloaded for free from Google Play.
Testing with TalkBack
The TalkBack accessibility service works by speaking the contents of user interface controls as the user moves focus onto controls. This service should be enabled as part of testing focus navigation and audible prompts.
To enable the TalkBack accessibility service:
Launch the Settings application.
Navigate to the Accessibility category and select it.
Select Accessibility to enable it.
Select TalkBack to enable it.
Note: While TalkBack is the most available Android accessibility service for users with disabilities, other accessibility services are available and may be installed by users.
Testing with Explore by Touch
The Explore by Touch system feature is available on devices running Android 4.0 and later, and works by enabling a special accessibility mode that allows users to drag a finger around the interface of an application and hear the contents of the screen spoken. This feature does not require screen elements to be focused using an directional controller, but listens for hover events over user interface controls.
To enable Explore by Touch:
Launch the Settings application.
Navigate to the Accessibility category and select it.
Select the TalkBack to enable it.
Note: On Android 4.1 (API Level 16) and higher, the system provides a popup message to enable Explore by Touch. On older versions, you must follow the step below.
Return to the Accessibility category and select Explore by Touch to enable it.
Note: You must turn on TalkBack first, otherwise this option is not available.
Testing focus navigation
Focus navigation is the use of directional controls to navigate between the individual user interface elements of an application in order to operate it. Users with limited vision or limited manual dexterity often use this mode of navigation instead of touch navigation. As part of accessibility testing, you should verify that your application can be operated using only directional controls.
You can test navigation of your application using only focus controls, even if your test devices does not have a directional controller. The Android Emulator provides a simulated directional controller that you can use to test navigation. You can also use a software-based directional controller, such as the one provided by the Eyes-Free Keyboard to simulate use of a D-pad on a test device that does not have a physical D-pad.
Testing gesture navigation
Gesture navigation is an accessibility navigation mode that allows users to navigate Android devices and applications using specific gestures. This navigation mode is available on Android 4.1 (API Level 16) and higher.
Note: Accessibility gestures provide a different navigation path than keyboards and D-pads. While gestures allow users to focus on nearly any on-screen content, keyboard and D-pad navigation only allow focus on input fields and buttons.
To enable gesture navigation:
Enable both TalkBack and the Explore by Touch feature as described in the Testing with Explore by Touch. When both of these features are enabled, accessibility gestures are automatically enabled.
You can change gesture settings using Settings > Accessibility > TalkBack > Settings > Manage shortcut gestures.
Note: Accessibility services other than TalkBack may map accessibility gestures to different user actions. If gestures are not producing the expected actions during testing, try disabling other accessibility services before proceeding.

[Android Studio] string.xml : String value not appearing in Emulator

Hello~!
I am new to Android development and recently picked up Android Studio this week.
I'm following a book: Android 6 for Programmers An App-Driven Approach: Deitel Developer Series 3/e
Chapter 2 of the book talks about adding string resource values to your Text Views. This is pretty neat and it seems to work fine in the IDE, but not in the Emulator and I'm not really sure what the problem is.
It's very simple:
The Text View text property is: @string/welcome
The strings.xml file shows:
HTML:
<string name="welcome">Welcome</string>
activity_main.xml Design View is showing: "Welcome" as the value in this Text View
The emulator is showing "Hello World" as the value in this Text View
I don't know enough about Android Studio to know what I've done wrong.
Is there a setting I need to get the resource values to display properly?
Is it just an emulator issue?
Troubleshooting Attempts:
I've made 3 different Virtual Devices, and each one is showing the default "Hello World" instead of the resource value
I've made a second resource value call "test" and set the Text View text property to "@string/test" - same issue
Any help would be appreciated

MiNote2_MIUI_8.9.6_MiRoom_8.0.0

MiNote2_MIUI_8.9.6_MiRoom_8.0.0
Languages: Chinese / Russian / English
The best ROM I've had in my note 2
Sistema:
Qualitative location and finalization of the graphic resources of the system.
All irrelevant Chinese functions and services are disabled.
Maximum source optimization in all system applications for a better visualization in the Russian location.
Chinese software and other garbage were eliminated, which is irrelevant for Russia, and it also simply occupies internal and operational memory.
It uses its own correct blocking of advertising, which does not affect the important resources of the Internet.
Ads in all system applications are disabled.
The time zone database was updated.
Improved the definition and display of names of Russian operators.
The automatic configuration database of APN access points has been updated.
Added an extended pack of DriffeX icons for the themes "Default" and "Infinity". The number of icons is replaced.
Installed all the necessary Google services.
The firm animation of loading "MiRum" is added.
Magisk is pre-installed for ROOT-rights and SafetyNet.
Correct Google Pay payment work on devices with NFC support.
Advanced power-up menu: added the ability to restart in recovery and fast-start modes.
Correct the operation of any modification of the Mi Fit application.
The display of fractional numbers in Russian at the system level was corrected.
Two keyboards are preset: Gboard (system) and Smartkeyboard MIUI MOD (with the possibility to delete).
New emoji emoticons were added.
Instant creation of a screen capture by pressing the "Volume down + power on" keys.
Correct Wi-Fi work at 2.4 and 5 GHz.
Verification of the signature of the application is disabled. You can, for example, install a modified version on the official version of the application.
WORKING TABLE
Download for twrp: http://files.mi-room.ru/roms/8.9.6/MiNote2_MIUI_8.9.6_MiRoom_8.0.0.zip
Regards
New MiNote2_MIUI_8.8.16_MiRoom_8.0.0
vcx77 said:
New MiNote2_MIUI_8.8.16_MiRoom_8.0.0
Click to expand...
Click to collapse
Thanks mate, tested it and I am really happy!
God job!
MiNote2_MIUI_8.8.30_MiRoom_8.0.0
New MiNote2_MIUI_8.9.6_MiRoom_8.0.0

Categories

Resources