Calabash Android runtime error : Could not remove keyguard - android

I am getting the below error when i start the test server. The steps I followed are:
1) calabash-android resign features\com.whatsapp-v2.12.114-450480-Android-2.1.apk
2) calabash-android build features\com.whatsapp-v2.12.114-450480-Android-2.1.apk
Done signing the test server. Moved it to test_servers/55a1d403d4a789d5d979742ac47bc35c_0.5.10.apk
3)adb devices
List of devices attached
192.168.231.101:5555 device
4) calabash-android console features\com.whatsapp-v2.12.114-450480-Android-2.1.apk
5) irb(main):001:0> start_test_server_in_background
Then i see the below error..Please help
Starting calabash-android console...
Loading C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.10/irbrc
Running irb...
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
irb(main):001:0> start_test_server_in_background
Starting: Intent { act=android.intent.action.MAIN cmp=com.whatsapp.test/sh.calaba.instrumentationbackend.WakeUp }
Error type 3
Error: Activity class {com.whatsapp.test/sh.calaba.instrumentationbackend.WakeUp} does not exist.
RuntimeError: Could not remove the keyguard
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.10/lib/calabash-android/operations.rb:567:in `block in wake_up'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/retriable-1.4.1/lib/retriable/retry.rb:27:in `perform'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/retriable-1.4.1/lib/retriable.rb:9:in `retriable'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.10/lib/calabash-android/operations.rb:566:in `wake_up'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.10/lib/calabash-android/operations.rb:590:in `start_test_server_in_background'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/calabash-android-0.5.10/lib/calabash-android/operations.rb:133:in `start_test_server_in_background'
from (irb):1
from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):002:0>

the keyguard is basically the feature that allows locking your android phone (with or without PIN). calabash has builtin code to handle unlocking on your phone in this case as long as the phone is not locked by pin\password.
check if your device is locked using pin\password and remove it

Related

Android Cuttlefish Device Not Booting - launch_cvd Command Not Working (Error: run_cvd returned 23)

I have built a custom ROM that I'm testing on Android Cuttlefish, but when I go to boot the device on the command line using the launch_cvd command, I get the following errors:
[assemble_cvd ... fetcher_config.cpp:212] Could not find file ending in kernel
[assemble_cvd ... fetcher_config.cpp 212] Could not find file ending in initramfs.img
run_cvd returned 23
Subprocess 39641 exited with error code: 23
The main issue seems to lie in the 'error 23' that is returned by run_cvd.
I have tried Google searching and browsing popular forums where Android is built and debugged (XDA Forums, Reddit, StackOverflow, the Android Building Google Group, YouTube, and the web in general). I have also posted on Reddit and will post on the Android Building Google Group. Additionally, I have looked through the source code for Cuttlefish on Google's Git repo to find why the program is outputting the error to no avail.
Lastly, I read through the logfiles of Cuttlefish to see the errors outputted by Cuttlefish. The kernel.log file seems to show the kernel booted successfully (despite the command line saying that it couldn't find the kernel file), I would imagine the same is true of initramfs.img, but I have no way of confirming that initramfs.img was successfully found by launch_cvd. The logcat file is empty (likely because the Cuttlefish failed to boot) and launcher.log simply reproduces the output on the command line (which contain the four errors I listed above).
Could anyone help me troubleshoot this issue? Your help would be greatly appreciated!
Do ps -A | grep crosvm to see if crosvm is running already.
If it is do stop_cvd || true or kill crosvm process with process PID.

How to solve this valgrind issue?

I'm trying to run valgrind on an android OS but it couldn't start and it shows this errors that i couldn't find how to solve:
valgrind: Startup or configuration error:
Can't create client cmdline file in /tmp/valgrind_proc_87_cmdline_876a7612
valgrind: Unable to start up properly. Giving up.
Thanks in advance !
I tried to change the default path that valgrind use and which is shown on the error log but i couldn't make it
The problem is happening in the code where the Valgrind host is creating a fake /proc/<pid>/cmdline.
This file should be created in the location given by the first valid item in the following list:
The TMPDIR environment variable
The constant VG_TMPDIR that gets baked into the binary via a configure time option. This defaults to /tmp but can be overriden using configure --with-tmpdir=/your/tmp/dir. That would require that you get the Valgrind source and configure and build it. It is possible that you are using a package that was built using this option and is not compatible with your system.
Last resort, "/tmp"
All of the above checks just test that the string is non-null and not empty. They do not test for the existance and accessibility of the directory. That gets determined by the Valgrind version of mkstemp and the error message comes from 'valgrind_main'.
Valgrind needs to create a file TMPDIR/valgrind_proc_PID_cmdline_RAND where TMPDIR is described above, PID is the pid of the Valgrind process and RAND is a random number.
There is at least one other similar files that get created, for auxv.
There are no Valgrind command line options to turn off the creation of these files.

Bitrise Unable to find instrumentation info for: ComponentInfo

I have created a class with the Espresso Test, named InsertFirst.class, I have correctly tried it on my android studio project, and it works.
Now I am trying to do the same on Bitrise. I have this worflow:
Activate SSH key (RSA private key)
Git Clone Repository
Bitrise.io Cache:Pull
Do anything with Script step
Install missing Android SDK components
Android Lint
Android Unit Test
Android Build for UI Testing
[BETA] Virtual Device Testing for Android
Android Build
Deploy to Bitrise.io - Apps, Logs, Artifacts
Bitrise.io Cache:Push
All the steps works, a part of the step 9. That I have configured in this way:
But when I run a build I get this ouptup on this step:
Configs:
- AppPath: /bitrise/deploy/app-debug.apk
- TestTimeout: 900.000000
- FlakyTestAttempts: 0
- DownloadTestResults: false
- DirectoriesToPull:
- AutoGoogleLogin: false
- EnvironmentVariables:
- ObbFilesList:
- TestDevices:
---
Model API Level Locale Orientation
Nexus6 24 en portrait
---
- TestType: instrumentation
- TestApkPath: /bitrise/deploy/app-debug-androidTest.apk
- InstTestPackageID:
- InstTestRunnerClass: com.app.name.nameeapp.ui.login.InsertFirst
- InstTestTargets:
- UseOrchestrator: false
Uploading app and test files
- (1/1) running
- (0/1) running
=> Test finished
Test results:
Model API Level Locale Orientation Outcome
Nexus6 24 en portrait failure
And If I go to the Test Report, on the Firebase TestLab -> Test Artifacts -> instrumentation.results
I got this error:
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.app.name.nameeapp.test/com.app.name.nameeapp.ui.login.InsertFirst}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.app.cerere.cerereapp.test/com.app.name.nameeapp.ui.login.InsertFirst
at com.android.commands.am.Am.runInstrument(Am.java:890)
at com.android.commands.am.Am.onRun(Am.java:400)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
at com.android.commands.am.Am.main(Am.java:121)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
Why? I miss something in the step? Or there is something that I forgot? Thanks

Add native service to aosp

I am trying to add a native service written in C++ to the AOSP build.
The first thing I did was to create a native service and client to the AOSP build.
This worked as expected. I could start the service within an adb shell and call it via binder on a adb shell.
The trouble started when I wanted to start my service with init.
I added a .rc file to my build
service myp /system/bin/myp_service
class main
This did the the trick so that init tried to start it but it failed because of SELinux policies.
So I added a file_contexts to my device tree and added:
/system/bin/myp_service u:object_r:myp_exec:s0
Next I added a myp.te file and added:
type myp, domain;
type myp_exec, exec_type, file_type;
type myp_service, service_manager_type;
init_daemon_domain(myp)
net_domain(myp)
binder_use(myp)
binder_service(myp)
add_service(myp, myp_service)
binder_call(myp, binderservicedomain)
binder_call(myp, appdomain)
allow myp myp_service:service_manager add;
And finally I added a service_contexts file with:
myp u:object_r:myp_service:s0
This finally made my service successfully start at boot time.
Unfortunalty I cannot use binder against this service. When I try to connect to the service with my client the call
defaultServiceManager()->getService(String16("Demo"))
returns a null pointer.
I cannot find any hints in the dmesg.
So I assume I am still missing something for the SElinux but I have no clue what I am missing.
If I shutdown the SELinux with setenforce and restart the service then it works fine.
Can anyone give me a hint what I am missing for SELinux or where I can get more information about which policy blocked something?
You could see the denials like this:
adb logcat | grep "SELinux : avc" > /tmp/logs
Get sepolicy current file. (Can be taken from device this way adb pull sepolicy.
Using audit2allow (located in AOSP source code: external/selinux/prebuilts/bin/audit2allow or in SDK tools. Do this: cat /tmp/logs | .external/selinux/prebuilts/bin/audit2allow -p sepolicy
The audit2allow tool will tell you what permission you are missing for the logcat extracted and the current sepolicy file, watch-out because you could need to do this several times since fixing some permissions will show the next ones required.
If you have a userdebug kind of build you could get setenforce 0, logcat with it and all the denials will be in logcat even if you will be permited to do the operation desired. This will leave the audit2allow iterations required in 1.
For anyone who came across this problem, please make sure your service_contexts file is successfully merged with stock service_contexts file. If you're building your service for Android O or later, please put this file inside a folder and refer to it in your Makefile by BOARD_PLAT_PRIVATE_SEPOLICY_DIR1. And you don't need to add allow myp default_android_service:service_manager add if the build system does pick up your service_contexts.
Also, about the domain.te violation problem, you probably want to attach one of the coredomain or appdomain attribute to your domain 2 with typeattribute <your_domain> <attribute>;.
Finally, please double check the following built files to make sure you don't leave any sepolicy configurations out in the final build:
$(AOSP_ROOT)/out/target/product//obj/ETC/file_contexts.bin_intermediates/file_contexts.*
$(AOSP_ROOT)/out/target/product/potter/obj/ETC/plat_service_contexts_intermediates/service_contexts.*
$(AOSP_ROOT)/out/target/product/potter/obj/ETC/sepolicy_neverallows_intermediates/policy.conf

How to enable assertions in Eclipse v3.7.2

I can't seem to get assertions working in my eclipse android project. I have followed the directions at this site
But I still can't get them to work. My code looks like:
assert(false) : "PROGRAM ERROR - invalid dialog call";
any ideas?
Dalvik VM ignores Java assertions by default. To enable that, one must change debug.assert property, e.g by invoking command in command line:
adb shell setprop debug.assert 1
Please note that you have to restart VM after that (force stop application: Settings->Apps->click on the app->Force stop).
Please also note that the setting is not persistent (assertions will be disabled again after phone reboot). However on rooted phones there's a way to make it persistent by putting /data/local.prop file containing line
debug.assert=1
What language are you expecting to use with the above?
I would try:
assertTrue("Expected true", true);
assertFalse("Expected false", true);
assertEquals("Expected equal", "same", "same");
Junit:
junit-docs/junit/framework/Assert.html

Categories

Resources