I have question about Android 7.0 boot sequence.
In Android 6.0, the init process will parse the init.rc and initiate the mediaserver:
service media /system/bin/mediaserver
class main
user main
group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm qcom_diag radio cw_access
...
But in Android 7.0, the init.rc doesn't have the above code, so i wondering who is the one initiate the mediaserver?? could be systemserver or not?
Try to find a file named mediaserver.rc in frameworks/native. Android 7.0 tryes to separate the init.rc actions and services according to reason. And you'll find them in system/etc/init/ on the device.
Related
I'm working on a non phone device that run Android 2.3.3. We have a custom Android version (with some additionnal driver) and my application has "system" privileges since we build our apps with the same key used to build android.
I had unlocked full Android API (including com.android.internal.*) following this post : https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/.
I deleted the Phone.apk from the device to ensure that no process is using rild.
I can instanciate a GSMPhone from my app, but after, I'm unable to execute any commands like supplyPin or getImei. I always have the same error :
CommandException: RADIO_NOT_AVAILABLE.
I'm really stuck here, any help would be precious.
CommandException: RADIO_NOT_AVAILABLE indicates that the rild socket is not opened. In other words, the rild service is not attached to the underlying basebane/modem you are using.
Run ps in adb shell to check if rild service is in the list. If it is in the list, run ls -l /dev/tty* and check if the modem device attached with the Android platform exists here or not. If it does not exist, it means that the Kernel is unable to enumerate your modem device and you need to add support in kernel for it. If it exists, run adb logcat -b radio and check the radio logs output which would really be helpful to diagnose the issue further.
adb shell ps | grep rild to check if RILD is in runing.
Since you can access all the api, do some initialization like PhoneApp do in Phone application OnCreate(mostly like setting params to modem, set radio power which will power on/off the modem, etc)
Is there any way to disable/enable NFC via ADB shell commands?
I found one answer here.
What I tried from the above link:
# Enable NFC
service call nfc 5
# Disable NFC
service call nfc 4
but it's not working.
Any help appreciated. Thanks.
I don't know why no one has posted this already
svc nfc <enable|disable>
Works perfectly
Edit: Requires > Android 6.0
# Disable NFC
service call nfc 7
Verified for Android 8.0
Cheers!
In your DDMS of eclipse or using logfilter or any runtime log capturing tool, you need to get the process ID of your NFCService. Then you can kill or stop that process by giving the process ID.
System services' method codes may vary with Android versions. Therefore, before making a service's method call browse the AOSP sources.
Below is a summary of the NFC's enable/disable calls up to Android 5.1.1. Also keep in mind that (in the sources)
int FIRST_CALL_TRANSACTION = 0x00000001
,i.e. equals to 1.
Android 4.4 - Android 5.1.1:
# Disable NFC
service call nfc 5
# Enable NFC
service call nfc 6
Android 4.0.1 - Android 4.3.1:
# Disable NFC
service call nfc 4
# Enable NFC
service call nfc 5
Android 2.3.4 - Android 2.3.7:
# Disable NFC
service call nfc 18
# Enable NFC
service call nfc 19
Android 2.3.3:
# Disable NFC
service call nfc 20
# Enable NFC
service call nfc 21
Android 2.3.2:
# Disable NFC
service call nfc 13
# Enable NFC
service call nfc 14
To check the status of the NFC service use the dumpsys command:
dumpsys nfc
Please try this
# Enable NFC
service call nfc 6
# Disable NFC
service call nfc 5
please check here in slide no 32
For Android Version > 7, please use following -
# Enable NFC
service call nfc 7
# Disable NFC
service call nfc 6
Verified on 7.1.1... Should work for atleast 7.x
A custom piece of hardware is running Android with the audio drivers installed.
An simple Android app is created to play some audio using media player, the app is tested on a emulator so it works for sure.
When running the device on the hardware, error message from logcat displays the following many times:
01-01 01:09:16.355 2792-3186/? E/audio_hw_primary﹕ pcm_open(PCM_CARD) failed: cannot open device '/dev/snd/pcmC0D1p': No such file or directory
01-01 01:09:16.375 2792-3186/? E/audio_hw_primary﹕ pcm_open(PCM_CARD) failed: cannot open device '/dev/snd/pcmC0D1p': No such file or directory
01-01 01:09:16.435 2792-375/? E/AudioSink﹕ received unknown event type: 1 inside CallbackWrapper !
under /dev/snd/ there are
controlC0
pcmC0D0c
pcmC0D0p
timer
I am able to play system notifications without any problem. I could also hack the problem by creating a symbolic link pcmC0D1p pointing to pcmC0D0p, and it works. Why is android trying to play non-system sound track on pcmC0D1p? Who is controlling which output it goes to?
pcmC0D1p means :
pcm
Card 0
Device 1
Capture/Playback p
Clearly, whatever the node your app is accessing is not present as seen through your ls /dev/snd/.
Normally, if you are playing non-standard sounds like mp3 files, writing to AudioTrack, will handle everything.
If you see only one playback node by doing ls /dev/snd, it means you have only one playback node present, which I think (not sure though) is occupied for standard android sounds.
If "pcmC0D1p" device is present in /dev/snd then try to give permission with command
chmod 777 /dev/snd/pcmC0D1p
If it is still not working then this sound card is not available.
I want to start a native service daemon, when my device is decteded(i.e. the devices is create at boot time). I saw the android init.rc document and got this grammer:
device-removed-<path> Triggers of these forms occur when a device node is added or removed.
So I think I can use this grammer to start my daemon. Then I modify init.rc as below,
on device-added-/dev/fp_dev
setprop fp.hardware.vendor llc
start fpDaemon
#Finger Feature for llc
service fpDaemon /system/bin/gxFpDaemon
disabled
user system
group system
Above grammer means, when my device name (fp_dev for example) was added when booting time, I start the native service daemon. But, the problem is the device is added when booted, but the daemon is not started as required. what's wrong with this? Many thinks.
I would need to create C++ console application that runs under non-privileged user under Android 5 (rooted). This application listens on some socket port and accepts connections. It is implemented with boost::asio. When application runs as a root, then everything works. When it runs as an ordinary user, then application crashes when it tries to open acceptor:
const boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::address::from_string("127.0.0.1"), 3784);
boost::asio::ip::tcp::acceptor acceptor(ioService);
acceptor.open(endpoint.protocol()); // Here it throws an exception
The exception is a bit confusing but probably it means that I don't have access rights to touch sockets:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): open: Permission denied
Aborted
I tried to run application under user shell and under user media. I also tried to run it under user u0_a83, that is assigned to ProxyDroid on my device.
I changed /system/etc/permissions/platform.xml -- I assigned permission android.permission.INTERNET to user shell and media . I also tried to add group media to android.permission.INTERNET, but nothing has helped.
Btw. this is a special case when I really need to implement application in C++ to run under Android. Implementation in Java is not acceptable in my project.
It seems that the best solution is to use users that are predefined in Android and corresponds to capabilities available on the system: https://android.googlesource.com/platform/system/core/+/master/include/private/android_filesystem_config.h . In my case I can run the app under user inet (3003) that can create sockets.