Вы находитесь на странице: 1из 11

Search r/Android

 854   How I manag… CLOSE

Posted by u/Mikuro Pixel 2 5 years ago 

How I managed to use my Android device with a broken


touch screen
A couple days ago my Nexus 4 fell, face-down, flat on the floor. The screen
cracked, and touch controls are completely dead. Boo hoo, of course, but I'm
not here to talk about problems; I'm here to talk about solutions.

Question: What can I do without a working touchscreen?

Answer: Pretty much everything.

Plan A: Set up my Bluetooth mouse. To do so, use remote control software.

Plan B: Ehh, we'll figure that out when we get there.

I know I can launch apps from adb. But with the screen locked, what good
does that do? My first thought was something like BBQScreen or AirDroid.
Turns out AirDroid doesn't actually let me control the screen, only view it. I
found that out too late. :\

Many of the steps here are actually not necessary or not the easiest way, but
I've included my entire process for educational purposes. This assumes you
are rooted and have USB debugging enabled. If you don't, then getting
around that will be your step 1, and that'll have to be an exercise for the
reader for now. If your bootloader is unlocked (or you don't mind wiping your
device to unlock it), anything should be possible.

1. Disable the lock screen through USB debugging. Must manually edit one
of Android's sqlite3 databases to do this. (Do not copy/paste in bulk. It
won't work due to changing shells and programs.)

adb shell
su
cp /data/data/com.android.providers.settings/databases/sett
chmod 665 /sdcard/settings.db
exit
exit
adb pull /sdcard/settings.db settings.db
sqlite3 settings.db
insert into secure (name, value) values ('lockscreen.passwo
update secure set value=1 where name='lockscreen.disabled';
^D
adb push settings.db /sdcard/settings.db
adb shell
su
cd /data/data/com.android.providers.settings/databases/
mv settings.db settings.db.bak
cp /sdcard/settings.db settings.db
chown system:system settings.db
chmod 660 settings.db
Search
exit r/Android
exit
 854 adb 
reboot
How I manag… CLOSE

Why use /sdcard as an intermediary? Well, I can't adb pull/push with protected
storage (such as /data), since the adb daemon itself doesn't use root. "adb
root" fails, saying it doesn't work on production builds. This probably depends
on your kernel. I'm on stock 4.4 kernel (but I am rooted). So I need to copy to
and from sdcard in a root shell to get my grubby hands into /data.

2. Okay, that didn't work. Better also remove the password files.

adb shell
su
cd /data/system
mkdir lock
mv password.key gesture.key locksettings* lock
exit
exit
adb reboot

YAAAY. No more lockscreen! Now I can...well, I still can't do much of anything.


But I'm getting there.

3. Enable Bluetooth.

adb shell
su
am start -a android.bluetooth.adapter.action.REQUEST_ENABLE

Aw crap, it asks for confirmation on screen. I can't turn on Bluetooth until I get
my Bluetooth mouse connected, can't connect the Bluetooth mouse until I turn
on Bluetooth. Classic chicken-and-egg problem. But just as science has proven
that the egg came without any proper chickens before it, so will I prove that I
can turn on goddamn Bluetooth without clicking any goddamn buttons.

4. Back to the database! This time we'll really enable Bluetooth:

sqlite3 settings.db
update global set value=1 where name='bluetooth_on';

Then adb push and reboot like we did before. Aww yeah, Bluetooth is on.
Almost done! Turn on the Bluetooth mouse. Unfortunately I hadn't ever paired
it since my last OS reset, so it didn't autoconnect. I should've known. Onward!

5. Maybe I can use remote-control software. Doesn't AirDroid have that? The
hardest part is finding the name of the activity within AirDroid (or any app you
need to launch). A little Googling and I found it. I think I could've extracted it
from the apk easily enough if necessary, but glad I didn't have to. Let's also
enable wifi so AirDroid can work.

adb shell
am start -a android.intent.action.MAIN -n com.sand.airdroid/.
svc wifi enable #isn't that easy?
Search r/Android
6. Load up the AirDroid interface in my browser. Ugh. AirDroid asks for
confirmation on my phone. Another button to click!
 854   How I manag… CLOSE

7. Screw it! All this manually editing SQL databases is making me batty. There's
gotta be a way to simulate taps/keystrokes through adb. Oh, turns out there
is. "input tap xcoord ycoord". Sweet. Looks like I just wasted a lot of time edited
SQL databases.....

Okay, so forget AirDroid. I'll just tap my way to Bluetooth. I just need to work
out the x/y coordinates of everything I need to tap. Let's just guess some. My
homescreen has a 5x6 grid, and the settings app is 2 down and 4 from the left.
The Nexus 4 screen is 1280x768. I think 600/300 ought to do it.

adb shell
su
input tap 600 300

Aww, that hit the one on top. Let's hit the back button and try 600/400 instead.

input tap 100 1270 input tap 600 400

Bingo! Settings is up. The Bluetooth item is the second one down. You know, it
looks like roughly the same location as my Setting icon. Let's just try the same
thing.

input tap 600 400

Bingo bango! I'm in. I turn on my mouse. I see it in the list. It looks like...wait,
the same location on screen again? Really? Could I be that lucky?

input tap 600 400

Bingo bango bongo! Jackpoooooot!

If I'd known it was so easy to simulate taps, I wouldn't have bothered disabling
the lock screen, or manually enabling Bluetooth through sqlite3. However, I
think these techniques are worth putting out there, especially since simulating
a gesture lock would be a big fat pain in the booty.

I hope this helps someone. If your touchscreen is toast, it doesn't necessarily


mean your device is unusable. You can still get in there and do what you need
to do. Maybe run Titanium Backup to prepare your next device. Maybe just
hook it up to your TV to use for streaming. Or maybe you just want to use your
phone with a mouse every day to see the looks on people's faces. The choice is
yours.

Cheers!

Edit: formatting. Seems like I needed extra indents for the code tag to take
effect here.

 139 Comments  Share  93% Upvoted

ADVERTISEMENT
Search r/Android

 854   How I manag… CLOSE

This thread is archived



New comments cannot be posted and votes cannot be cast

SORT BY BEST

 dstoro 72 points · 5 years ago


 This is awesome. Thank you.

 TrialByWater 47 points · 5 years ago


 Amazing stuff, and the fact that you went that far to try to connect
your mouse as well. I would have just ADB'ed some APK's and the
DCIM directory and have been done with the device.

Android: Flexible and open when you need it most!

 vs8 34 points · 5 years ago


 My Nexus 7 screen is broken too. I got an OTG cable and mouse, it
works pretty well.

 noconservants 8 points · 5 years ago


 Too bad N4 OTG is broken. =/
I had a really bad time when my screen broke.
Continue this thread 

 413j0 36 points · 5 years ago


 you could try this two: https://code.google.com/p/androidscreencast/
http://droid at screen ribomation com/
VIEW ENTIRE DISCUSSION (139 COMMENTS)

More posts from the Android community

Posted by u/megablast 20 hours ago

R6 - Mods missed this one, and post above discussion threshold


Rwanda just released the first smartphone made
entirely in Africa
R6 - Mods missed this one, and post above discussion threshold 

fastcompany.com/904149... 

 8.9k   554 Comments  Share 

PROMOTED • Posted by u/FluidStack 2 months ago 


Airbnb for computers. Rent out your computer when it's idle. Help
Search r/Android
accelerate websites and bring down the cost of cloud computing.
Just install FluidStack and earn $5-$50/month!
 854   How I manag… CLOSE

provider.fluidstack.io/ SIG N UP

 78   Comment  Share

Posted by u/vbp32 3 days ago

Google will require Android 10 on new devices


approved after January 31
xda-developers.com/google... 

 5.1k   433 Comments  Share 

Posted by u/i_post_tech_articles 2 days ago

Windows update lets you answer Android calls on


a PC
cnet.com/news/w... 

 4.1k   778 Comments  Share 

Posted by u/fastforward23 2 days ago

New Essential Device Shown


twitter.com/Arubin... 
Search r/AndroidAndy Rubin @Arubin · Oct 9, 2019
Replying to @Arubin
...still dialing in the colors
 854   How I manag… CLOSE

Andy Rubin
@Arubin

New UI for radically different formfactor


 3.9k   947 Comments  Share 

Posted by u/AguirreMA 4 days ago

PS4 Remote Play will finally be available on non-


Xperia devices, plus DS4 support on Android 10
blog.us.playstation.com/2019/1... 

 3.3k   318 Comments  Share 

Posted by u/ga-vu 6 days ago

Google finds Android zero-day impacting Pixel,


Samsung, Huawei, Xiaomi devices
zdnet.com/articl... 

 2.9k   282 Comments  Share 

Posted by u/iamvinoth 1 day ago

We've started rolling out dark mode for Gmail in the latest update.
You should see an option to enable it if you have iOS 11+/Android 10+
soon.
twitter.com/gmail/... 
Search r/Android ①⓿ @Jid_10 · Oct 10, 2019
@gmail when will we be able to mark as read an
email directly from the notification bar ? And what
 2.9k
854   How I manag… CLOSE
   431 Comments mode ?
 Share
about dark

Posted by u/modemman11 4 days ago

SCAM WARNING: Do not download any apps from PLATDI Studio


They currently have 4 apps listed. One is a voice changer that is actually number
one in the top grossing charts for personalization, and even has a paid
advertisement when searching for voice changers in the app store. However the big
issue here is after installing you find out they want you to activate a free 3 day trial.
Then they charge you $200/year. Yes, TWO HUNDRED dollars. Yearly. When other
apps do the same things for a one time purchase of less than $10 or even free.
Being a subscription, your card on file is charged immediately after the 3 day trial
ends. So clearly they are banking on people just forgetting about the trial, or people
not reading the price and hoping it's just a dollar or two.

As always make sure to have your google account set to require your password for
all purchases, especially if you have kids using your phone, as a child may want a
voice changer app, but not quite understand the concept of money yet.
 2.8k   117 Comments  Share 

Posted by u/VegarHenriksen 6 days ago

Oppo uploads then deletes surreal, hilariously


bad ColorOS ads
androidpolice.com/2019/1... 

 1.9k   181 Comments  Share 

Posted by u/curated_android 6 days ago

Google will release Pixel 4 on AT&T, widening


Verizon, T-Mobile and Sprint's Pixel line
availability - PhoneArena
phonearena.com/news/P...  

 1.8k   234 Comments  Share 

Posted by u/zanda19 2 days ago

Google Docs, Sheets, and Slides apps get a new


look on Android
androidcentral.com/google... 

 1.8k   125 Comments  Share 

PROMOTED • Posted by u/wsopgame 24 days ago 

This 6 year old poker game keeps getting better and better with
monthly updates and daily live events. Join in and start enjoying the
best poker experience on the internet.
Search r/Android

 854   How I manag… CLOSE

playwsop.com/ PLAY N O W

 133   Comment  Share

Posted by u/ProperGearbox 3 days ago

Google requires new Android devices with Type-C


to not break USB-PD
xda-developers.com/google... 

 1.8k   203 Comments  Share 

Posted by u/Kobahk 5 days ago

Months ago, Google executive for Android tweeted his requisites for
the perfect Bluetooth earbuds. Will rumored Pixel earbuds be like
this?
twitter.com/lockhe... 

 1.6k   333 Comments  Share 

Posted by u/Slovantes 5 days ago

Asus Zenfone 6 - Edition 30, 12gb ram, 512gb


storage, 5000 mah battery, flip camera with
custom shooting angles (same quality selfies as

back camera with OIS, flash, wide camera...), no
Search r/Android
notch and near-stock
asus.com/Phone/...  android experience.

 854   How I manag… CLOSE

 1.4k   349 Comments  Share 


Search r/Android

 854   How I manag… CLOSE


Search r/Android

 854   How I manag… CLOSE

Continue browsing in r/Android

Вам также может понравиться