Coder Social home page Coder Social logo

adblib's People

Contributors

cgutman avatar ckesc avatar tps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adblib's Issues

Just a question

Hello
I am a newbie in android.
There are several question about adblib.

  1. In my opinion, communication in one socket connection is sequential, there should be only at most one active open stream in AdbConnection. So why there is openStreams:HashMap in AdbConnection?
  2. If communication in one socket connection is sequential, Isn't blocking read and write simpler than multithread/wait/notify ? Why there is extra connection Thread handling message reading?
    Thanks a lot

Could you pls provide any demo code? Thx!

I try to "adb connect" android device with shell command these days and found that some devices could not be connected successful which display "unauthorized". I guess the reason is using "connect" command by shell could not get RSA code which is use to get authority.

So I want to use adblib to connect device. Could you pls provide any demo code to use adblib?

Kindly Help

Thank you very much for open sourcing this project first!!!
It is quite pretty and usefull.
I want to use this lib to implement the function that can send some files from one device to the connected device. It will just like use the PC to send command line "adb push /xxx/xxx/test.txt /xxx/xxx/xxx/test.txt".
Could you please kindly give me some tips ?
Thanks again !!!

Re-prompt to allow USB debugging

Please look at my issue.Thank you very much.

Old issure:
I am using your adblib, thank you very much for being open source.
I met a question and wanted to ask for your help. I use your project on Android, the code as same as your demo, the interface is AdbCrypto.loadAdbKeyPair.However,when I re-open my application, it need to re-prompt to allow USB debugging, but the computer's RSA key as same as last RSA.

How to send Ctrl+C?

I know it's possible you have a Ctrl+C send option in the adb app built in, but I was wondering how to send such a command for myself using this library. I can't seem to find out how.

OutOfMemoryError

I've seen this on two devices at least, occurs at AdbProtocol.java#L292:

java.lang.OutOfMemoryError: Failed to allocate a 1598575456 byte allocation with 7544583 free bytes and 248MB until OOM, target footprint 15089167, growth limit 268435456
	at com.cgutman.adblib.AdbProtocol$AdbMessage.parseAdbMessage (AdbProtocol.java:276)

tananaev/adblib#18

running adb root

Hi @cgutman,
I would like to run a command "adb root" and not passing through adb shell (which works):
using adb shell: getprop ro.build.version.incremental it is working:

                            String getpropCommand = "getprop ro.build.version.incremental";
                            AdbStream streamGetpropCommand = connection.open("shell:" + getpropCommand);

                            while (!streamGetpropCommand .isClosed()) {
                                try {
                                    String result = new String(streamGetpropCommand.read(), StandardCharsets.US_ASCII);
                                    // Print each thing we read from the shell stream
                                    System.out.println("-->step1: getprop result: " + result);
                                    if (!result.isEmpty()) {
                                        streamGetpropCommand.close();
                                    }

                                } catch (InterruptedException | IOException e) {
                                    e.printStackTrace();
                                    return;
                                }
                            }

and when using adb root does not work:

                                    String rootCommand = "adb root";
                                    AdbStream streamRootCommand = connection.open(rootCommand);
                                    while (!streamRootCommand.isClosed()) {
                                        try {
                                            String result = new String(streamRootCommand.read(), StandardCharsets.US_ASCII);
                                            // Print each thing we read from the shell stream
                                            System.out.println("--> step2: adb root result: " + result);
                                            if (!result.isEmpty()) {
                                                streamRootCommand.close();
                                            }

                                        } catch (InterruptedException | IOException e) {
                                            e.printStackTrace();
                                            return;
                                        }
                                    }

Backup process with "sync"

Hello @cgutman,

I want to backup some files via my developing application. So, I used "sync" connection and opened stream via "RECV". (I want to pull about 40 files in this stream).
But, sometimes adb pulled these files, sometimes no. When I debug this problem, read() function is not return anything. read() is always waiting.

How can I solve this problem?

(I hope, I can explain my problem.)

Javadoc Help

public AdbStream open(java.lang.String destination)
               throws java.io.UnsupportedEncodingException,
                      java.io.IOException,
                      java.lang.InterruptedException
Opens an AdbStream object corresponding to the specified destination. This routine will block until the connection completes.
Parameters:
               destination - The destination to open on the target
Returns:
               AdbStream object corresponding to the specified destination
Throws:
               java.io.UnsupportedEncodingException - If the destination cannot be encoded to UTF-8
               java.io.IOException - If the stream fails while sending the packet
               java.lang.InterruptedException - If we are unable to wait for the connection to finish

for the parameter destination
There is no indication of what can be filled in.
I only tested "shell:" or "reboot:"
If have other destinations, please tell me

Install option

How can I use this tool to install apk from source (not from destination) like "adb install .apk" when using pc?

Is it even possible.

AdbLib fork

Just want to let you know that I have created a fork of your library:

https://github.com/tananaev/adblib

The main reason is to publish it on maven repository to simplify adding it as a dependency. Had to change package name to match my group id.

Another small thing is addition of an option to provide key pair to crypto class. I use android key store system to generate and store keys, so I needed a way to pass it into adblib.

Thank you very much for open sourcing this project. I started developing some similar first, but then stumbled upon your library and decided to use it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.