增加moshi
This commit is contained in:
@@ -279,6 +279,7 @@ dependencies {
|
|||||||
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'
|
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'
|
||||||
//okhttp
|
//okhttp
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||||
|
implementation 'com.squareup.moshi:moshi:1.9.3'
|
||||||
//4.9.3最后一个4.x版本
|
//4.9.3最后一个4.x版本
|
||||||
//Retrofit
|
//Retrofit
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
|
|||||||
@@ -57,16 +57,16 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/ImmerseTheme">
|
android:theme="@style/ImmerseTheme">
|
||||||
<activity android:name=".activity.AoleyunTestActivity">
|
<activity android:name=".activity.AoleyunTestActivity">
|
||||||
<intent-filter>
|
<!-- <intent-filter>-->
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||||
</intent-filter>
|
<!-- </intent-filter>-->
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activity.main.MainActivity">
|
<activity android:name=".activity.main.MainActivity">
|
||||||
<!-- <intent-filter> -->
|
<intent-filter>
|
||||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<!-- </intent-filter> -->
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activity.KotlinMainActivity">
|
<activity android:name=".activity.KotlinMainActivity">
|
||||||
<!-- <intent-filter> -->
|
<!-- <intent-filter> -->
|
||||||
|
|||||||
20
app/src/main/aidl/com/uiui/sn/IGetInfoInterface.aidl
Normal file
20
app/src/main/aidl/com/uiui/sn/IGetInfoInterface.aidl
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// IGetInfoInterface.aidl
|
||||||
|
package com.uiui.sn;
|
||||||
|
|
||||||
|
// Declare any non-default types here with import statements
|
||||||
|
|
||||||
|
interface IGetInfoInterface {
|
||||||
|
/**
|
||||||
|
* Demonstrates some basic types that you can use as parameters
|
||||||
|
* and return values in AIDL.
|
||||||
|
*/
|
||||||
|
void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
|
||||||
|
double aDouble, String aString);
|
||||||
|
|
||||||
|
//获取系统开关
|
||||||
|
boolean isControl();
|
||||||
|
//获取app是否在管控时间
|
||||||
|
boolean inControl(String pkg);
|
||||||
|
//获取app禁用提示
|
||||||
|
String getDisableContent(String pkg);
|
||||||
|
}
|
||||||
@@ -10,7 +10,6 @@ import android.content.IntentFilter;
|
|||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.hardware.usb.UsbManager;
|
import android.hardware.usb.UsbManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
@@ -23,7 +22,6 @@ import android.widget.Button;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.info.sn.IGetInfoInterface;
|
|
||||||
import com.jiaoguanyi.appstore.IGetLicenseInterface;
|
import com.jiaoguanyi.appstore.IGetLicenseInterface;
|
||||||
import com.notepad.uiui.INoteAidlInterface;
|
import com.notepad.uiui.INoteAidlInterface;
|
||||||
import com.tt.ttutils.base.ImmerseBaseActivity;
|
import com.tt.ttutils.base.ImmerseBaseActivity;
|
||||||
@@ -34,9 +32,9 @@ import com.tt.ttutils.utils.java.JGYUtils;
|
|||||||
import com.tt.ttutils.utils.java.TTUtils;
|
import com.tt.ttutils.utils.java.TTUtils;
|
||||||
import com.tt.ttutils.utils.java.ToastUtil;
|
import com.tt.ttutils.utils.java.ToastUtil;
|
||||||
import com.tt.ttutils.utils.jni.NDKTools;
|
import com.tt.ttutils.utils.jni.NDKTools;
|
||||||
|
import com.uiui.sn.IGetInfoInterface;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
@@ -225,6 +223,8 @@ public class MainActivity extends ImmerseBaseActivity {
|
|||||||
registHideAppReceiver();
|
registHideAppReceiver();
|
||||||
registForbidAppReceiver();
|
registForbidAppReceiver();
|
||||||
registerUserInfoReceiver();
|
registerUserInfoReceiver();
|
||||||
|
registerAppTimeControlReceiver();
|
||||||
|
registerSnTimeControlReceiver();
|
||||||
String ndks = NDKTools.getStringFromNDK();
|
String ndks = NDKTools.getStringFromNDK();
|
||||||
mServiceConnection = new ServiceConnection() {
|
mServiceConnection = new ServiceConnection() {
|
||||||
@Override
|
@Override
|
||||||
@@ -312,13 +312,22 @@ public class MainActivity extends ImmerseBaseActivity {
|
|||||||
// ApkUtils.openApp(JMainActivity.this, "com.info.sn");
|
// ApkUtils.openApp(JMainActivity.this, "com.info.sn");
|
||||||
if (getInfoInterface != null) {
|
if (getInfoInterface != null) {
|
||||||
try {
|
try {
|
||||||
String userInfo = getInfoInterface.getUserInfo();
|
// String sn = getInfoInterface.getSerial();
|
||||||
Log.e("mIGetInfoConnection", "getUserInfo: " + userInfo);
|
// Log.e("mIGetInfoConnection", "getSerial: " + sn);
|
||||||
List<String> hideAPP = getInfoInterface.getHideAPP();
|
// String userInfo = getInfoInterface.getUserInfo();
|
||||||
Log.e("mIGetInfoConnection", "getHideAPP: " + hideAPP);
|
// Log.e("mIGetInfoConnection", "getUserInfo: " + userInfo);
|
||||||
List<String> forbidAPP = getInfoInterface.getForbidAPP();
|
// List<String> hideAPP = getInfoInterface.getHideAPP();
|
||||||
Log.e("mIGetInfoConnection", "getForbidAPP: " + forbidAPP);
|
// Log.e("mIGetInfoConnection", "getHideAPP: " + hideAPP);
|
||||||
textView.setText(userInfo);
|
// List<String> forbidAPP = getInfoInterface.getForbidAPP();
|
||||||
|
// Log.e("mIGetInfoConnection", "getForbidAPP: " + forbidAPP);
|
||||||
|
boolean isControl = getInfoInterface.isControl();
|
||||||
|
Log.e("mIGetInfoConnection", "isControl: " + isControl);
|
||||||
|
boolean isAvailable = getInfoInterface.inControl("com.zhiduoke.fxy");
|
||||||
|
Log.e("mIGetInfoConnection", "inControl: " + isAvailable);
|
||||||
|
String content = getInfoInterface.getDisableContent("com.zhiduoke.fxy");
|
||||||
|
Log.e("mIGetInfoConnection", "getDisableContent: " + content);
|
||||||
|
|
||||||
|
// textView.setText(userInfo);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.e("mIGetInfoConnection", "getUserInfo: " + e.getMessage());
|
Log.e("mIGetInfoConnection", "getUserInfo: " + e.getMessage());
|
||||||
@@ -444,6 +453,53 @@ public class MainActivity extends ImmerseBaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String APP_TIME_CONTROL_UPDATE = "APP_TIME_CONTROL_UPDATE";
|
||||||
|
public static final String SN_TIME_CONTROL_UPDATE = "SN_TIME_CONTROL_UPDATE";
|
||||||
|
|
||||||
|
private AppTimeControlReceiver mAppTimeControlReceiver;
|
||||||
|
|
||||||
|
private void registerAppTimeControlReceiver() {
|
||||||
|
if (mAppTimeControlReceiver == null) {
|
||||||
|
mAppTimeControlReceiver = new AppTimeControlReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction(APP_TIME_CONTROL_UPDATE);
|
||||||
|
registerReceiver(mAppTimeControlReceiver, filter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AppTimeControlReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (action.equals(APP_TIME_CONTROL_UPDATE)) {
|
||||||
|
String jsonString = intent.getStringExtra("jsonString");
|
||||||
|
Log.e("AppTimeControlReceiver", "onReceive: " + jsonString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SnTimeControlReceiver mSnTimeControlReceiver;
|
||||||
|
|
||||||
|
private void registerSnTimeControlReceiver() {
|
||||||
|
if (mSnTimeControlReceiver == null) {
|
||||||
|
mSnTimeControlReceiver = new SnTimeControlReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction(SN_TIME_CONTROL_UPDATE);
|
||||||
|
registerReceiver(mSnTimeControlReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SnTimeControlReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (action.equals(SN_TIME_CONTROL_UPDATE)) {
|
||||||
|
String jsonString = intent.getStringExtra("jsonString");
|
||||||
|
Log.e("SnTimeControlReceiver", "onReceive: " + jsonString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void bindService() {
|
private void bindService() {
|
||||||
if (noteAidlInterface == null) {
|
if (noteAidlInterface == null) {
|
||||||
@@ -471,9 +527,9 @@ public class MainActivity extends ImmerseBaseActivity {
|
|||||||
if (getInfoInterface == null) {
|
if (getInfoInterface == null) {
|
||||||
//这是连接aidl服务的代码
|
//这是连接aidl服务的代码
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction("com.info.sn.IGetInfoInterface");
|
intent.setAction("com.uiui.sn.IGetInfoInterface");
|
||||||
intent.setPackage("com.info.sn");
|
intent.setPackage("com.uiui.sn");
|
||||||
intent.setComponent(new ComponentName("com.info.sn", "com.info.sn.service.RemoteService"));
|
intent.setComponent(new ComponentName("com.uiui.sn", "com.uiui.sn.service.RemoteService"));
|
||||||
bindService(intent, mIGetInfoConnection, Context.BIND_AUTO_CREATE);
|
bindService(intent, mIGetInfoConnection, Context.BIND_AUTO_CREATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user