Android: Modifying Car UX Restrictions by overlaying car_ux_restrictions_map.xml - android

I am trying to disable all car UX restrictions by overlaying <android_source>/packages/services/Car/service/res/xml/car_ux_restrictions_map.xml.
I created <vendor-path>/overlay/packages/services/Car/service/res/xml/car_ux_restrictions_map.xml and added baseline restrictions for all drive modes in this file.
I also created <vendor_path>/overlay/packages/services/Car/service/res/values/attrs.xml, basically copied it over from <android_source>/packages/services/Car/service/res/values/attrs.xml.
However when I run my Android emulator and try to change drive modes, CarUxRestrictionsConfigurationXmlParser.java can't seem to read R.styleable.UxRestrictions_Restrictions_uxr and ends up setting restrictions on all drive modes to fully restricted, which further ends up locking my emulator UI for all drive modes.
Anybody know what might be the issue here? Do I need to make an AndroidManifest.xml, create and install an APK, etc.?

Related

Create custom LockScreen for Android

I'm trying to create a custom lockscreen for Android version 7.1.1. (Nougat). I know that there are a lot answers on how to create a custom lockscreen, but whatever code I try to use, it's not really working.
The problem appears because of using deprecated methods. The app crushes, and there are no methods to replace the deprecated ones.
Does anyone know a way that this still works?
These are some of the links I've tried to use (there were a few older ones also but I didn't save them):
how to make our own lock screen in android instead of default lock screen
https://github.com/thomasvidas/Simple-Lockscreen/tree/master
developing an android lock screen application
Create custom lockscreen for android 4.0 or above?
At the end I managed to make this app working. My biggest problem was to put my device in kiosk mode (disabling hardware buttons when the lockscreen is displayed). The solution that worked for me was enabling device owner mode using Android Debug Bridge. It wasn't the best solution, but it was the most acceptable one for this project.
Here are some of the links that I used to achieve this:
https://documentation.meraki.com/SM/Device_Enrollment/Enabling_Device_Owner_Mode_using_Android_Debug_Bridge_(ADB)
http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/

Android: How to make device run only one app?

I have an customer project where I have to make single task android device. Customer isn't able to escape the application which my company have developed. Also customer isn't able to start any other application and our application is started when the device is booted. Overall all the customer is able to do with the device is run our application.
Is there any other way to make this work than rooting the device, disabling all system buttons and making our application the launcher. I have something like 400 devices for this purpose so rooting all those would cost lot of time.
I also read Google's tutorial about COSU devices but found it very confucing https://developer.android.com/work/cosu.html#testing-plan
Androids own screen pinning is not good enough because customer can escape the app. Some may suggest to use some kiosk application like SureLock but my company's goal is to find clear solution for this without using any third party apps. Also running our app via some kiosk application is not our goal.
I found some posts on the Stack Overflow with similar question, but not the answer I'm looking for.
If someone has some tips for this question I would be very grateful.
Single purpose devices built on top of Android can get difficult to implement. There are a few different options, but each have trade-offs.
As you mentioned, rooting devices will functionally get you what you want - however it will be time consuming with hundreds of devices to root, difficult to maintain, and you will (potentially) introduce security issues to your devices and app.
Another option is using Google's Lock Task Mode for COSU devices[1]. The link there has a nice graphic showing the features of lock task mode:
1 app pinned to the home screen
only apps white-listed by the DPC (device policy controller) can be locked
Home and Recent buttons hidden
exit by calling stopLockTask()
There are some downsides to using Google's solution for this. First Google recommends creating (and therefor maintaining) an entirely separate DPC app to run as a device owner and set policies[2]. You'll also be dependent on Google Play to manage application updates and be required to have Play accounts associated with each device which "are used to identify a single device that is not tied to a single user for simplified, per-device app distribution rules in COSU-style scenarios"[3]. To automatically get your DPC app on devices your "DPC must be publicly availble on Google Play, and the end user can install the DPC from the device setup wizard by entering the DPC-specific identifier."[3] You'll also need to upload the user application to Google Play[4], which may be an issue for some who don't want their apps on Play. Going this route gives you features you need, but can be complicated and also ties you and your customer pretty tightly with Google/Play services and their workflow.
You can also look at enterprise mobile deployment platforms like Mason[5]. In your case, you can create a custom Android OS in a few minutes with your app locked in kiosk mode (+ other features like disable camera/sms, remove apps and hide settings, etc.) and then deploy it to all of your devices remotely. Mason also supports OS and app updates controlled by you if your requirements change.
DISCLAIMER: I work for Mason
[1] https://developer.android.com/work/cosu.html
[2] https://developer.android.com/work/cosu.html#create-dpc
[3] https://developers.google.com/android/work/requirements/cosu
[4] https://developers.google.com/android/work/play/emm-api/samples#push_install_an_app_on_a_device
[5] https://bymason.com/
I went to the same problem before. I spent at least 3 days doing research. I tried to find many solutions but I found zero.
How I solve is
1. Up To JellyBean
- Use System Alert Dialog (And make it transparent and small size like 2 * 2 And display in some corner(User can't see it)). User can't press home button If there is system Alert dialog
2. After JellyBean, This method doesn't work. The user can press the home button even though there is System Alert Dialog.
so what I did is, start the service on stop and start the same activity again and again(within sec). So user can't see any difference.Don't forget to make activity as single task so that even though you start same activity from service, again and again, new activity will not create (So Ugly way )
- You can simple make screen full screen. make sure in kiosk mode try to check if the screen is in full-screen mode. if not make it full-screen mode(its not hard to do)
- other way is to make launcher app but when ever you pressed home button it always asked to choose launcher app. if user mistakenly choose default/ other launcher app, this solution doesnt work
Good luck
Make your application as a launcher application by defining in manifest file.
After that go to setting of your mobile device and change default launcher application to your application.

Running two applications simultaneously

I'm working on an application which contains a transparent screen and I need other applications such as Google Maps to run behind it, is there a way to run 2 apps simultaneously ?
Currently when I open my app all I see behind it is the menu displaying all opened apps, but can't figure out how to keep apps running behind mine.
I'm working on an application which contains a transparent screen and I need other applications such as Google Maps to run behind it
Given the fact that other developers write those other applications, you have no reliable way to knowing exactly what the user can see through the transparent portion of your UI. That will vary based on device, version of the other app, etc.
Currently when I open my app all I see behind it is the menu displaying all opened apps
What is visible through your transparent portion of your UI is whatever activity happens to be behind it.
can't figure out how to keep apps running behind mine
The decision of what other apps do is up to the developers of those other apps, not you.
is there a way to run 2 apps simultaneously ?
You are certainly welcome to start some activity (e.g., a map), and then some time later start some other activity (e.g., the one of yours with the transparent pane). What the other app does, when you do this, is up to the developers of the other app, not you.

Add icon to Android's Quick Settings

My question is similar to this one. I'm running Android 4.4 on my device, and want to add additional options to the quick settings. I noticed that turning on/off the Alarm Clock shows/hides a tile in the quick settings, like this:
The biggest difference in the two questions is I want to know what it would take to make it work, either having the device rooted, or flashing a custom app at install or what. I've been trying to browse the source code here, but so far I haven't seen anything that stands out to me.
Sorry about the picture size, I don't know if there's an option to scale them down...
Android N introduced Quick Settings API which allow application to add status icon in quick settings. Please check Android N preview document to learn more.
I'm pretty sure you need to be rooted. I have not come across anything that will let you add tiles under completely stock android. Depending on your phone, you might be able to root it without voiding the warranty explicitly, however it will be tricky. After which you can look at installing something xposed framework and then different xposed modules (I suggest gravity box as it lets you add most options to the quick settings). But again, it's all at your own risk for voiding your warranty or soft-bricking your phone. Good luck!

How to let the portrait app in landscape mode

I customize the android system, the resolution is 1024x768 The target device must be in the landscape mode, it's fixed. And some apps are only have the portrait mode, can not be used.
So I want to change something that let the portrait app display in the center and the resolution is 640x480 How can I do it? I can do anything, including change the android or linux kernel code.
How can I do it?
For apps that you write yourself, you modify the apps to run successfully in landscape mode.
For apps that your firm intends to license from other developers, have them make a landscape-compatible version of the app as a precondition of your license.
If you intend to allow third-party apps to be installed on this device by the end user, modify the installation process to detect the fact that one or more activities are flagged as running landscape-only and present a warning to the user at install time, so they know that the app they are trying to install will not run well on your device.
Modifying Android in the manner you describe may be possible, but it is the sort of thing that will require lots of time and effort and is well outside the scope of a StackOverflow question.

Categories

Resources