Skip to content

Commit

Permalink
t push origin master Merge branch 'danuid-lib_ver_update'
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Mar 4, 2021
2 parents a655483 + ecb1e51 commit 59c8402
Show file tree
Hide file tree
Showing 25 changed files with 78 additions and 120 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ simply run the following command
```
adb forward tcp:9008 tcp:9008
adb shell am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub \
com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner
com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner
```

# Run
Expand Down Expand Up @@ -136,15 +136,15 @@ If you have any idea, please email codeskyblue@gmail.com or [submit tickets](htt
- [nanohttpd](https://github.com/NanoHttpd/nanohttpd)
- [jsonrpc4j](https://github.com/briandilley/jsonrpc4j)
- [jackson](https://github.com/FasterXML/jackson)
- [com.android.support.test.uiautomator](https://mvnrepository.com/artifact/com.android.support.test.uiautomator/uiautomator-v18)
- [androidx.test.uiautomator](https://mvnrepository.com/artifact/androidx.test.uiautomator/uiautomator-v18)

# Added features
- [x] support unicode input

# Resources
- [Google UiAutomator Tutorial](https://developer.android.com/training/testing/ui-testing/uiautomator-testing?hl=zh-cn)
- [Google UiAutomator API](https://developer.android.com/reference/android/support/test/uiautomator/package-summary?hl=zh-cn)
- [Maven repository of uiautomator-v18](https://mvnrepository.com/artifact/com.android.support.test.uiautomator/uiautomator-v18)
- [Maven repository of uiautomator-v18](https://mvnrepository.com/artifact/androidx.test.uiautomator/uiautomator-v18)

# Thanks to
- [xiaocong](https://github.com/xiaocong)
Expand Down
19 changes: 8 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ android {
// 1: original version
// 2: update all dependencies to latest
// 6: input method, battery,rotation monitor
def buildTendId = System.getenv("TEND_ID")
def buildChannel = "official"

defaultConfig {
buildConfigField "String", "buildTendId", "\"${buildTendId}\""
buildConfigField "String", "buildChannel", "\"${buildChannel}\""
applicationId "com.github.uiautomator"
minSdkVersion 18
targetSdkVersion 28
Expand Down Expand Up @@ -78,7 +74,7 @@ android {
}

defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

packagingOptions {
Expand All @@ -99,17 +95,18 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

// server
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'commons-cli:commons-cli:1.3.1'

// test
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
androidTestImplementation 'com.android.support:support-v4:28.0.0'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'androidx.test:runner:1.3.0'

androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'androidx.core:core:1.3.0'
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
androidTestImplementation 'com.github.briandilley.jsonrpc4j:jsonrpc4j:1.5.0'

implementation project(':permission')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import android.app.Notification;
import android.app.UiAutomation;
import android.os.Parcelable;
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.UiDevice;
import android.view.accessibility.AccessibilityEvent;

import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import android.app.UiAutomation;
import android.graphics.Rect;
import android.os.Build;
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.UiDevice;
import android.util.Log;
import android.util.Xml;
import android.view.accessibility.AccessibilityNodeInfo;
Expand All @@ -24,7 +24,7 @@


// Note:
// Here is a copy of android.support.test.uiautomator.AccessibilitiNodeInfoDumper source code
// Here is a copy of androidx.test.uiautomator.AccessibilitiNodeInfoDumper source code
// in order to fix dump hierarchy error
//
// Sync to new code: https://android.googlesource.com/platform/frameworks/testing/+/master/uiautomator/library/core-src/com/android/uiautomator/core/AccessibilityNodeInfoDumper.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

package com.github.uiautomator.stub;

import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.UiDevice;

import com.googlecode.jsonrpc4j.JsonRpcServer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
package com.github.uiautomator.stub;

import android.os.RemoteException;
import android.support.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiObjectNotFoundException;

import com.googlecode.jsonrpc4j.JsonRpcError;
import com.googlecode.jsonrpc4j.JsonRpcErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@
import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemClock;
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.Configurator;
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.StaleObjectException;
import android.support.test.uiautomator.UiCollection;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.Until;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.Configurator;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.StaleObjectException;
import androidx.test.uiautomator.UiCollection;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiScrollable;
import androidx.test.uiautomator.UiSelector;
import androidx.test.uiautomator.Until;
import android.view.KeyEvent;
import android.view.MotionEvent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

package com.github.uiautomator.stub;

import android.support.test.uiautomator.Configurator;
import androidx.test.uiautomator.Configurator;

/**
* Created by xiaocong@gmail.com on 12/26/13.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
package com.github.uiautomator.stub;

import android.os.RemoteException;
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.UiDevice;

public class DeviceInfo {
private String _currentPackageName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

package com.github.uiautomator.stub;

import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiSelector;

public class ObjInfo {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

package com.github.uiautomator.stub;

import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiSelector;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.UiSelector;

import java.util.regex.Pattern;

Expand Down
18 changes: 9 additions & 9 deletions app/src/androidTest/java/com/github/uiautomator/stub/Stub.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
import android.content.Context;
import android.content.Intent;
import android.os.RemoteException;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest;
import android.support.test.filters.SdkSuppress;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.Configurator;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.Configurator;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.Until;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import android.content.Context;
import android.os.PowerManager;
import android.os.SystemClock;
import android.support.test.uiautomator.Configurator;
import android.support.test.uiautomator.UiDevice;
import androidx.test.uiautomator.Configurator;
import androidx.test.uiautomator.UiDevice;
import android.util.Log;
import android.view.InputDevice;
import android.view.InputEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

package com.github.uiautomator.stub.watcher;

import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector;
import androidx.test.InstrumentationRegistry;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiSelector;

import com.github.uiautomator.stub.Log;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
package com.github.uiautomator.stub.watcher;

import android.os.RemoteException;
import android.support.test.InstrumentationRegistry;
import androidx.test.InstrumentationRegistry;
import android.view.KeyEvent;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiSelector;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiSelector;
import com.github.uiautomator.stub.Log;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

package com.github.uiautomator.stub.watcher;

import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.UiWatcher;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiSelector;
import androidx.test.uiautomator.UiWatcher;

/**
* Created with IntelliJ IDEA.
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@
<uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION"
tools:ignore="MockLocation,ProtectedPermissions" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
Expand Down
18 changes: 2 additions & 16 deletions app/src/main/java/com/github/uiautomator/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import android.text.format.Formatter;
import android.util.Log;
import android.view.View;
Expand All @@ -27,7 +27,6 @@
import com.github.uiautomator.util.MemoryManager;
import com.github.uiautomator.util.OkhttpManager;
import com.github.uiautomator.util.Permissons4App;
import com.tendcloud.tenddata.TCAgent;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -80,25 +79,12 @@ public void run() {
}
}


private void initTCAgent() {
TCAgent.LOG_ON = true;
// App ID: 在TalkingData创建应用后,进入数据报表页中,在“系统设置”-“编辑应用”页面里查看App ID。
// 渠道 ID: 是渠道标识符,可通过不同渠道单独追踪数据。
TCAgent.init(this, BuildConfig.buildTendId, BuildConfig.buildChannel);
// 如果已经在AndroidManifest.xml配置了App ID和渠道ID,调用TCAgent.init(this)即可;或与AndroidManifest.xml中的对应参数保持一致。
TCAgent.setReportUncaughtExceptions(true);
Log.i(TAG, "TCAgent init done");
}

@RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

this.initTCAgent();

tvAgentStatus = findViewById(R.id.atx_agent_status);
tvAutomatorStatus = findViewById(R.id.uiautomator_status);
tvAutomatorMode = findViewById(R.id.uiautomator_mode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.support.annotation.RequiresApi;
import androidx.annotation.RequiresApi;
import android.util.Log;
import android.view.InputDevice;
import android.view.InputEvent;
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/github/uiautomator/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import android.util.Log;

import com.github.uiautomator.monitor.AbstractMonitor;
Expand Down
23 changes: 0 additions & 23 deletions app/src/main/java/com/github/uiautomator/TCAgentApplication.java

This file was deleted.

Loading

0 comments on commit 59c8402

Please sign in to comment.