Android Remote Control through ADB

Today, I stumbled on perhaps the most ingenious use of ADB ever:

Remote control your Android phone through adb

A program and write-up by Marian Schedenig, that they shared on their website. This is perhaps the best adb tool I have ever seen, in that it takes three simple principles and puts them together to allow you to remote control your phone over ADB with your mouse, without ROOT permission!

output3

Here is a small gif that I put together from a screen recording of me using this awesome java tool. Essentially, it uses adb to take screen shots of the phone. Then it downloads the screen shot and updates it’s display. Finally, when you click on the screen, it sends an x/y co-ordinate to the phone over adb to tell it you swiped or clicked! It is absolutely brilliant!

The updates are a little slow, and you do have to edit the config file for your specific needs, but it works great, and is a really useful tool if you broke your screen or have touch screen issues, or just need to display your screen for an audience to view while you press buttons or work with apps. Since it is written in java, it is cross platform as well!

Linux – keep it simple.

Advertisements

YouTube milestone, 1000 subscribers want to know how to build Android!

Hey everyone! Praise God! Great news! I just passed 1000 subscribers on YouTube and I just wanted to take a minute to thank all of you for taking this journey with me.

It’s a bit funny, since I thought that posting the original videos about building Android was a one time deal, and after that I would be done making them. Through your encouragement and questions, I’ve now got over 240 videos all about building android and apps.

I have a new link for my channel:
http://www.youtube.com/c/AlaskaLinuxUserAKLU

But don’t worry, the old one still works if you have it bookmarked.

I’ve got a few more adventures in android building coming up, including upgrading the BLU phone to Oreo ( I was able to boot Oreo the other day, it doesn’t work very well, but it is pretty good progress for a lollipop phone ), including marshmallow and nougat along the way.

Please keep the questions and suggestions coming in, as these help me understand what videos I should focus on next. Down the road I hope to make some videos on building without ninja and jack, as well as building generic system images ( gsi ). Thanks again everyone!

-Alaskalinuxuser

Update to Rom/Kernel/TWRP building guide!

Hey everyone!

Just wanted to let you know that I was able to finish and upload another hour worth of videos! That’s right, currently there is more than 9 hours of video tutorial available. As promised, this was added to the series:

* Installing/using VirtualBox
* Fixing a VB Ubuntu problem with screen resolution
* Syncing minimal LineageOS or Omni for building TWRP
* Converting an Omni TWRP device to LineageOS/CM and building it.
* Custom TWRP mods with fonts/icons/splash screens/etc….

twrp

Hope that you are enjoying the series, but mostly, I hope that it is informative and gets you building!
I did try to up the video quality, but I had to tone it back down a bit, as the files became a bit large for uploading and handling. The quality is a little better than the first videos, but not exactly 1080p! 

Thanks again for all of the thanks button slaps and YouTube subscriptions. That lets me know that you guys really appreciate the videos. Be sure to check out my Video Tutorial section in the menu for links to the videos!

Linux – keep it simple.

Putting Android Nougat on a Nook HD+

While there are several guides out there on how to do this, I ran into a slight snag while trying to put Android Nougat on a Nook HD+, so I thought I’d share that with you. I was following this guide: https://nookhdplusandroid7.wordpress.com/

Following through the instructions seemed to go very smoothly, until it didn’t work. Specifically, after putting in the micro SD card, and powering off the device, powering it on would just cause a blank screen. Then, several minutes later, the device would turn on as normal.

Turns out that the Nook just didn’t like my SD card. It was a 4 GB card that I had laying around. When I opened a new package of 16 GB PNY SD cards, the whole process started working.

I don’t want to rehash the excellent write up that was already given, but I thought I would share my small issue, in case someone else runs into that problem. Turns out, there are some newer roms available for the Nook HD+ as well.

Either way, here are a couple of screen shots about showing the outcome:

It seems to work rather nicely. I did notice one slight “glitch” to the screen when I selected MTP for the USB mode, but other than that, it seems to work great! Now I just have to force myself to give it back to it’s owner!

Linux – keep it simple.

Video Tutorial on How to Compile Android and Modify Kernels

video

For those interested, I have just posted a video tutorial series on XDA for building Android Oreo, Nougat, Marshmallow, and Lollipop on 5 different phones, the emulator, and 5 different ROMs. Also included are custom kernel editing, adding apps, changing source code, backgrounds, and more. Here’s what I posted:

From XDA: https://forum.xda-developers.com/android/general/guide-how-to-build-custom-roms-kernel-t3814251

===========================================================================

Praise God! Finally a video tutorial of how to build Android and modify kernels!

I have created a video tutorial and guide for how to compile Android, from Lollipop through Marshmallow, Nougat, and Oreo. The video series covers several different phones, the emulator, kernel and rom editing, app source code editing, and much more!

Who is this video series for?
Well, this video tutorial is a step by step guide built primarily for the beginner. This is written for those who already know how to flash TWRP, CWM, or the like, and who have installed a custom rom before. This is designed to help those who are ready to move up from flashing and installing other peoples custom rom to actually start making their own custom roms. I recommend that a beginner watch the entire series in numerical/alphabetical order (the videos are marked).

That said, I believe that an intermediate developer may find a useful trick here and there, and they should just skip ahead to videos of interest. Perhaps kernel development, or something along those lines.

An advanced rom/kernel developer will probably far exceed my feeble abilities, and will not likely find much useful information here. Perhaps if you are an advanced developer, you would consider continuing the tutorial or making an advanced video series! (See further posts for recommendations on contributing videos.)

Why did you put this together?
Well, after building roms for several different devices, I started receiving requests from users who wanted to start building their own roms, but didn’t know how. I didn’t have enough time to answer everyones questions, so I wrote a few guides, pointed others to guides that were available, but there are some things that you just need to see to understand. Hence, the video tutorial. I just hope that someone finds it useful.

This course was written in order! While Lollipop and Marshmallow are old by today’s standards, there is still good learning value in building them, and there are topics covered there that really make them worth watching.

What’s in the videos?
During the series, we will be building for the emulator, as well as 5 different phones of various brands, and 5 different roms. I hope that this will give the viewer a good idea of how to build for their own specific phone as they see the differences and similarities across the phones and custom roms.

[CODE]
+ Ubuntu installation
+ Java installations
+ Using Git, GitHub, GitKraken, and the command line
+ Fastboot and ADB
+ Heimdall/Odin
+ QFIL, QPST, SALT, and other tools
+ AOSP, SlimRoms, PACrom, AOKP, AOSCP
+ Lollipop, Marshmallow, Nougat, Oreo
+ Errors
+ Overclocking CPU/GPU
+ Adding Governors and I/O Schedulers
+ Sound modifications
+ Changing app colors, text, and icons
+ Adding prebuilt apps
+ Adding source code
+ Converting device from one rom to another
+ AND MORE!
[/CODE]

**** This is an UNOFFICIAL TUTORIAL. Use at your own risk! ****
Download links:
Ogg Vorbis Video GitLab:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide[/url]
Clicking on a video in GitLab will allow you to watch it online.

Ogg Vorbis Video Downloads:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide/-/archive/master/course_android_developer_guide-master.zip[/url]
This download is rather large due to the multiple videos.

MP4 Video GitLab:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide_mp4[/url]
Clicking on a video in GitLab will allow you to watch it online.

MP4 Video Downloads:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide_mp4/-/archive/master/course_android_developer_guide_mp4-master.zip[/url]
This download is rather large due to the multiple videos.

I also have several written guides available on XDA, here are a few:

Building ROMs for the Galaxy Note Edge: [url]https://forum.xda-developers.com/note-edge/general/guide-build-aosp-roms-kernels-note-edge-t3488840[/url]
Building ROMs for the Galaxy S4: [url]https://forum.xda-developers.com/galaxy-s4-tmobile/general/guide-step-step-instructions-building-t3402637[/url]

===========================================================================

Be sure to check out the videos or the XDA thread! I hope that these will help some of the aspiring Android developers out there!

Linux – keep it simple.

Adding a countdown timer to my Android notification….

This was actually a great idea brought up by a user, and posted in my issue tracker for the Hourglass app. He pointed out that it would be really handy to have the remaining time posted in the notification popup, and get it to be consistently updated.

I thought there must surely be something for this in Android already, but I couldn’t find one. However, I did find a chronometer that can count how long a notification has been open. With some careful thought, here is what I came up with:

NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
        .setSmallIcon(R.drawable.hourglass).setWhen(System.currentTimeMillis()+recureTime).setUsesChronometer(true)
        .setContentTitle("Hourglass").setContentText(intentPhrase);

What I found was that I could “back up” time to before the notification started. Essentially giving it a negative number. Then, passing the time saved for recurring alarms (even saved if not used), then I can set it to a negative of that number. Now it counts “up” from negative time, giving the appearance of counting down your timer!

timer_notification

Works pretty well, however, 2 interesting things. I would have thought the code should be MINUS recureTime, not PLUS recureTime, but it only works properly with PLUS.

Second, the “countdown timer” in the notification doesn’t track exactly with the Hourglass app timer. In the course of several minutes, it becomes off by a second. Odd, but workable. The timer still goes off in the app on time, just that the countdown in the notification may get there a second early.

Linux – keep it simple.

Connecting to my Bluefruit Feather from my Android phone!

This Christmas, my brother was kind enough to get me a great new toy to play with: a Bluefruit Feather! It’s a Bluetooth capable board with input and output pins for controlling objects, collecting information, or just about anything if you properly engineer the attachments.

So far my knowledge of working with this cool board is in the infancy stage. I’m not sure that I’m crawling yet, probably just rolling over at this stage of the game, but I’m already having fun! At present it has 3 blinking lights that are constantly flashing. A yellow light for USB connectivity, a blue light for Bluetooth connectivity, and a red light that I think is either power, or a charging indicator (I don’t currently have a battery for it, but it is supposed to charge the battery through the USB connection).

I did have a little bit of trouble connecting to it with my Android phone, so I thought I’d share my process here, so maybe you will not have to figure out the problem on your own if you get one of these impressive little gadgets.

First, I downloaded the app from the Play Store:

https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect

But you can also download the source code for the app and build it yourself here:

https://github.com/adafruit/Bluefruit_LE_Connect_Android

After installing the app, I turned on the Bluetooth of my Android Marshmallow phone, plugged in the Bluefruit Feather board to a USB port for power, and paired wirelessly to it from my phone. So far, so good.

Then I opened up the app. The app did not list my board. Refreshing didn’t help either. There was a brief pop up that I missed because I was click happy, so I exited the app and opened it again to find that in Marshmallow, to be able to see the board, location services needed to be turned on in the phone.

Easy enough, so I went to settings -> location, and turned on location services. But it still didn’t work. Turns out I had to turn on “high accuracy” on my phone in the location settings to get it to work. Once that was done, the app could now find my paired Bluefruit Feather!

There look like a lot of really cool functions that you can do with the app. I am looking forward to trying it out!

Linux – keep it simple.

Taking a screen shot of an Android phone while it is still booting.

I stumbled upon an interesting tidbit the other day. I was trying to take a screenshot of my Android phone while it was playing the boot animation. Of course I tried the standard adb tools:

adb shell screencap -p /sdcard/screencap.png

To which I would follow with an adb pull to get the file. However, since this was during an Oreo bring-up, Some things still were not right, and it couldn’t create the screenshot due to not finding the /sdcard. So I Googled a bit, and found this command:

adb shell screencap -p | sed ‘s|\r$||’ > screenshot.png

Which gave me a file, but it was corrupt and wouldn’t work. Further tinkering and searching, I found that it needed to take care of two carraige returns, like so:

adb shell screencap -p | sed ‘s|\r\r$||’ > screenshot.png

And voila! Now it works!

screenshot

Linux – keep it simple.

Hourglass app: recurring timer option?

ss4.png

Last week I mentioned the changes to the Hourglass app in regards to manual time entry. As I looked over the commits, I realized that I forgot to mention the addition of a recurring timer option.

As you can see in the picture, there is now a little set of circular arrows that stand for repeating the timer. You can tap on it to turn off and on repeat mode. In essence, all that I did was add a check at the end of the time to see if you wanted it to be repeated. If the answer is yes, it set it up to run again, if not, then the timer ends. Either way you still get the vibration, the sound, and the pop-up, and the title bar notification still works.

The commit itself is a bit too long to post here, but here is a snippet from the code:

​+ public void recurChoice (View recurView) {
 +
 + if (recureYes) {
 +
 + // Set the boolean.
 + recureYes = false;
 + // Set the image.
 + recure.setImageResource(R.drawable.notrecur);
 +
 + } else {
 +
 + // Set the boolean.
 + recureYes = true;
 + // Set the image.
 + recure.setImageResource(R.drawable.recur);
 +
 + }
 +
 + }

As you can see, this just adds the option to toggle the button. You can read the full commit here:

https://github.com/alaskalinuxuser/app_hourglass/commit/2317f71a04b619ecafa56e282d63baeac72ba420

And thanks to Mr. Pfeffer for bringing this great idea to my attention. It really has made the app all the more useful!

Linux – keep it simple.

Edited Hourglass app manual time entry function.

ss5

Last week GitHub user spaetz brought forward a great idea for the Hourglass Android timer app that I made a while back. He recommended that the manual time entry be adjusted so that entering any number without a colon (:) would be counted as minutes. Here you can see his issue in the tracker:

https://github.com/alaskalinuxuser/app_hourglass/issues/7

After a quick review of the code, I came up with a simple fix, which you can see in my commit here:

https://github.com/alaskalinuxuser/app_hourglass/commit/fb28250c74e59582e887ede69cf75c1f061caf3c

Essentially, I just check to see if the entered time includes a colon. If it does, then I check it as usual. If not, then I take it as minutes only. Nothing spectacular here, but this is the main portion of the change:

// We wrap this in try, so the app can’t crash if they put in some weird number….
 try {
 –
 + int sec,min,math;
 // Alright, let’s split that time based on colon.
 – String[] foundSplit = manualTime.split(“:”);
 + if (manualTime.contains(“:”)) {
 + String[] foundSplit = manualTime.split(“:”);
 + // Testing only // Log.i(“WJH”, foundSplit[0]);
 + // Testing only // Log.i(“WJH”, foundSplit[1]);

 – // And let’s get the seconds from the split.
 – String seconds = foundSplit[1];
 + // And let’s get the seconds from the split.
 + String seconds = foundSplit[1];

 – // And the minutes from the split.
 – String minutes = foundSplit[0];
 + // And the minutes from the split.
 + String minutes = foundSplit[0];

 – // Then we convert them to integers.
 – int sec = Integer.parseInt(seconds);
 – int min = Integer.parseInt(minutes);
 + // Then we convert them to integers.
 + sec = Integer.parseInt(seconds);
 + min = Integer.parseInt(minutes);
 + } else {
 + sec = 0;
 + min = Integer.parseInt(manualTime);
 + // Testing only // Log.i(“WJH”, String.valueOf(min));
 + }

 // And do some basic math to turn them into milliseconds.
 – int math = (min * 60 * 1000) + (sec * 1000);
 + math = (min * 60 * 1000) + (sec * 1000);

Note that the – symbol is a line deleted, and the + symbol is a line added.

But that’s what’s great about open source apps. Not only could someone suggest a change, someone could also make changes and offer up improvements. Either way, the Hourglass app is better for it with this addition.

Linux – keep it simple.