version:1.0.2
fix: update:优化主页
@@ -45,23 +45,11 @@
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
|
||||
<permission
|
||||
android:name="com.uiuipad.os.permission.XGPUSH_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="com.uiuipad.os.permission.XGPUSH_RECEIVE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<!-- 【常用】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
@@ -238,100 +226,6 @@
|
||||
<uses-library
|
||||
android:name="org.apache.http.legacy"
|
||||
android:required="false" />
|
||||
<!-- 【必须】 移动推送 TPNS 默认通知 -->
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="com.uiuipad.os"
|
||||
android:scheme="tpns" />
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS receiver广播接收 -->
|
||||
<receiver
|
||||
android:name="com.tencent.android.tpush.XGPushReceiver"
|
||||
android:process=":xg_vip_service">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
<!-- 【必须】 移动推送 TPNS SDK的内部广播 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.SDK" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
|
||||
<!-- 【可选】 系统广播:网络切换 -->
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
<!-- 【可选】 系统广播:开屏 -->
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<!-- 【可选】 一些常用的系统广播,增强移动推送 TPNS service的复活机会,请根据需要选择。当然,您也可以添加App自定义的一些广播让启动service -->
|
||||
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
|
||||
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
|
||||
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- 【必须】移动推送 TPNS service -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.service.XGVipPushService"
|
||||
android:persistent="true"
|
||||
android:process=":xg_vip_service" />
|
||||
|
||||
<!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.rpc.XGRemoteService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<!-- 【必须】请修改为当前APP名包.XGVIP_PUSH_ACTION -->
|
||||
<action android:name="com.uiuipad.os.XGVIP_PUSH_ACTION" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGPushProvider"
|
||||
android:authorities="com.uiuipad.os.XGVIP_PUSH_AUTH"
|
||||
tools:replace="android:authorities" />
|
||||
|
||||
<!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.SettingsContentProvider"
|
||||
android:authorities="com.uiuipad.os.TPUSH_PROVIDER"
|
||||
tools:replace="android:authorities" />
|
||||
|
||||
<!-- 【可选】用于增强保活能力 -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGVipPushKAProvider"
|
||||
android:authorities="com.uiuipad.os.AUTH_XGPUSH_KEEPALIVE"
|
||||
android:exported="true"
|
||||
tools:replace="android:exported,android:authorities" />
|
||||
|
||||
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
|
||||
<receiver android:name="com.uiuipad.os.push.tpush.MessageReceiver">
|
||||
<intent-filter>
|
||||
<!-- 接收消息透传 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
|
||||
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- MQTT START -->
|
||||
<service
|
||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service" />
|
||||
|
||||
<provider
|
||||
android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
|
||||
android:authorities="com.uiuipad.os.XG_SETTINGS_PROVIDER"
|
||||
android:exported="false"
|
||||
tools:replace="android:authorities" />
|
||||
|
||||
<!-- MQTT END-->
|
||||
|
||||
<!-- 消息接收监听器 (用户可自主扩展) -->
|
||||
<receiver
|
||||
@@ -362,22 +256,13 @@
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_ID"
|
||||
android:value="1500026378" />
|
||||
<!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_KEY"
|
||||
android:value="AH5QD9ZMBJ6R" />
|
||||
|
||||
<!-- 请填写你自己的- appKey -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appkey"
|
||||
android:value="333598281" />
|
||||
android:value="333898268" />
|
||||
<!-- 请填写你自己的appSecret -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appsecret"
|
||||
android:value="4a3f7e105d894a239ed089f18607bc5a" />
|
||||
android:value="3bb4bc02061344cc9499a338a9a187d9" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
174
build.gradle
@@ -11,7 +11,6 @@ buildscript {
|
||||
dependencies {
|
||||
classpath GRADLE_CLASS_PATH
|
||||
classpath PROTOBUF_CLASS_PATH
|
||||
classpath "com.tencent.android.tpns:tpnsplugin:1.8.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,24 +35,9 @@ final String FRAMEWORK_PREBUILTS_DIR = "${ANDROID_TOP}/prebuilts/framework_inter
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.google.protobuf'
|
||||
//apply plugin: "com.tencent.android.tpns"
|
||||
|
||||
|
||||
android {
|
||||
// gradle.projectsEvaluated {
|
||||
// tasks.withType(JavaCompile) {
|
||||
// Set<File> fileSet = options.bootstrapClasspath.getFiles()
|
||||
// List<File> newFileList = new ArrayList<>();
|
||||
// //JAVA语法,可连续调用,输入参数建议为相对路径
|
||||
// newFileList.add(new File("libs/framework.jar"))
|
||||
// //最后将原始参数添加
|
||||
// newFileList.addAll(fileSet)
|
||||
// options.bootstrapClasspath = files(
|
||||
// newFileList.toArray()
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
abortOnError false
|
||||
@@ -66,13 +50,8 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
|
||||
// //MTK
|
||||
versionCode 49
|
||||
versionName "2.3.9"
|
||||
|
||||
// //cube
|
||||
// versionCode 80
|
||||
// versionName "6.4.0"
|
||||
versionCode 3
|
||||
versionName "1.0.2"
|
||||
|
||||
ndk {
|
||||
//选择要添加的对应 cpu 类型的 .so 库。
|
||||
@@ -91,69 +70,7 @@ android {
|
||||
|
||||
//签名
|
||||
signingConfigs {
|
||||
zhanRui {
|
||||
storeFile file("src/doc/zhanxun.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanxun"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
zhanRuiUserdebug {
|
||||
storeFile file("src/doc/zhanxunUserdebug.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanxunUserdebug"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
zhanRui12 {
|
||||
storeFile file("src/doc/zhanrui12.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanrui12"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
mtk {
|
||||
storeFile file("src/doc/xueshibaoos.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "xueshibaoos"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
TeclastP20S {
|
||||
storeFile file("src/doc/MTKP20S.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "MTKP20S"
|
||||
keyPassword "123456"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
zhanruiG10Z{
|
||||
storeFile file("src/doc/zhanruiG10Z.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanruiG10Z"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G10P {
|
||||
storeFile file("src/doc/G10PMTK11.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "G10PMTK11"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
U807 {
|
||||
U807 {
|
||||
storeFile file("src/doc/AllwinnerU807.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "u807"
|
||||
@@ -177,85 +94,6 @@ android {
|
||||
signingConfig signingConfigs.U807
|
||||
}
|
||||
|
||||
G10PDebug.initWith(debug)
|
||||
G10PDebug {
|
||||
buildConfigField "String", "platform", '"MTK11"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G10P
|
||||
}
|
||||
|
||||
G10PRelease.initWith(release)
|
||||
G10PRelease {
|
||||
buildConfigField "String", "platform", '"MTK11"'
|
||||
signingConfig signingConfigs.G10P
|
||||
}
|
||||
|
||||
zhanRuiDebug.initWith(debug)
|
||||
zhanRuiDebug {
|
||||
versionNameSuffix "-debug"
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
debuggable true
|
||||
signingConfig signingConfigs.zhanRui
|
||||
}
|
||||
|
||||
zhanRuiRelease.initWith(release)
|
||||
zhanRuiRelease {
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
signingConfig signingConfigs.zhanRui
|
||||
}
|
||||
|
||||
//userdebug rom使用这个版本
|
||||
zhanRuiUserdebug.initWith(zhanRuiDebug)
|
||||
zhanRuiUserdebug {
|
||||
versionNameSuffix "-debug"
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
debuggable true
|
||||
signingConfig signingConfigs.zhanRuiUserdebug
|
||||
}
|
||||
|
||||
zhanRui12Debug.initWith(debug)
|
||||
zhanRui12Debug {
|
||||
versionNameSuffix "-debug"
|
||||
buildConfigField "String", "platform", '"AH6016"'
|
||||
debuggable true
|
||||
signingConfig signingConfigs.zhanRui12
|
||||
}
|
||||
|
||||
zhanRui12Release.initWith(release)
|
||||
zhanRui12Release {
|
||||
buildConfigField "String", "platform", '"AH6016"'
|
||||
signingConfig signingConfigs.zhanRui12
|
||||
}
|
||||
|
||||
TeclastP20SDebug.initWith(debug)
|
||||
TeclastP20SDebug {
|
||||
debuggable true
|
||||
versionNameSuffix "-debug"
|
||||
buildConfigField "String", "platform", '"P20S"'
|
||||
signingConfig signingConfigs.TeclastP20S
|
||||
}
|
||||
|
||||
TeclastP20SRelease.initWith(release)
|
||||
TeclastP20SRelease {
|
||||
buildConfigField "String", "platform", '"P20S"'
|
||||
signingConfig signingConfigs.TeclastP20S
|
||||
}
|
||||
|
||||
zhanruiG10ZDebug.initWith(debug)
|
||||
zhanruiG10ZDebug {
|
||||
buildConfigField "String", "platform", '"ZR6016"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.zhanruiG10Z
|
||||
}
|
||||
|
||||
zhanruiG10ZRelease.initWith(release)
|
||||
zhanruiG10ZRelease {
|
||||
buildConfigField "String", "platform", '"ZR6016"'
|
||||
signingConfig signingConfigs.zhanruiG10Z
|
||||
}
|
||||
|
||||
debug {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
debuggable true
|
||||
@@ -264,7 +102,7 @@ android {
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
//Zipalign优化
|
||||
zipAlignEnabled true
|
||||
signingConfig signingConfigs.mtk
|
||||
signingConfig signingConfigs.U807
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
@@ -285,7 +123,7 @@ android {
|
||||
//Zipalign优化
|
||||
zipAlignEnabled true
|
||||
//签名
|
||||
signingConfig signingConfigs.mtk
|
||||
signingConfig signingConfigs.U807
|
||||
//将release版本的包名重命名,加上版本及日期
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
@@ -460,8 +298,6 @@ dependencies {
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
//mmkv
|
||||
implementation 'com.tencent:mmkv-static:1.2.13'
|
||||
//腾讯移动推送 TPNS
|
||||
implementation 'com.tencent.tpns:tpns:1.3.2.0-release'
|
||||
//阿里云推送
|
||||
implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
|
||||
//下载
|
||||
|
||||
BIN
res/drawable-hdpi/com_uiui_aios.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
res/drawable-hdpi/com_uiui_zyos.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
res/drawable-hdpi/system_switch.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
res/drawable-hdpi/wallpapers.jpg
Normal file
|
After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 484 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 485 B |
@@ -23,7 +23,7 @@
|
||||
|
||||
<!-- Application name -->
|
||||
<string name="app_name">Launcher3</string>
|
||||
<string name="app_uiui">桌面</string>
|
||||
<string name="app_uiui">管控桌面</string>
|
||||
|
||||
<!-- Default folder name -->
|
||||
<string name="folder_name">文件夹</string>
|
||||
@@ -340,4 +340,6 @@
|
||||
|
||||
<!-- Failed action error message: e.g. Failed: Pause -->
|
||||
<string name="remote_action_failed">Failed: <xliff:g id="what" example="Pause">%1$s</xliff:g></string>
|
||||
|
||||
<string name="system_switching">系统切换</string>
|
||||
</resources>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
launcher:screen="1"
|
||||
launcher:x="1"
|
||||
launcher:y="0">
|
||||
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;component=com.android.deskclock/.DeskClock;end" />
|
||||
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;component=com.android.calendar/.AllInOneActivity;end" />
|
||||
</resolve>
|
||||
|
||||
<favorite
|
||||
@@ -98,13 +98,13 @@
|
||||
launcher:x="2"
|
||||
launcher:y="0" />
|
||||
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="2"-->
|
||||
<!-- launcher:x="2"-->
|
||||
<!-- launcher:y="0">-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_CALCULATOR;end" />-->
|
||||
<!-- </resolve>-->
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="2"-->
|
||||
<!-- launcher:x="2"-->
|
||||
<!-- launcher:y="0">-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_CALCULATOR;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<resolve
|
||||
launcher:container="-101"
|
||||
@@ -115,10 +115,18 @@
|
||||
<favorite launcher:uri="#Intent;type=images/*;end" />
|
||||
</resolve>
|
||||
|
||||
<!-- <favorite-->
|
||||
<!-- launcher:className="com.android.documentsui.files.FilesActivity"-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:packageName="com.android.documentsui"-->
|
||||
<!-- launcher:screen="4"-->
|
||||
<!-- launcher:x="4"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
|
||||
<favorite
|
||||
launcher:className="com.android.documentsui.files.FilesActivity"
|
||||
launcher:className="com.android.soundrecorder.SoundRecorder"
|
||||
launcher:container="-101"
|
||||
launcher:packageName="com.android.documentsui"
|
||||
launcher:packageName="com.android.soundrecorder"
|
||||
launcher:screen="4"
|
||||
launcher:x="4"
|
||||
launcher:y="0" />
|
||||
@@ -169,4 +177,54 @@
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="1"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
|
||||
<!-- <appwidget-->
|
||||
<!-- launcher:className="com.android.alarmclock.AnalogAppWidgetProvider"-->
|
||||
<!-- launcher:packageName="com.android.deskclock"-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:spanX="6"-->
|
||||
<!-- launcher:spanY="2"-->
|
||||
<!-- launcher:x="0"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
|
||||
<appwidget
|
||||
launcher:className="com.android.alarmclock.DigitalAppWidgetProvider"
|
||||
launcher:packageName="com.android.deskclock"
|
||||
launcher:screen="0"
|
||||
launcher:spanX="6"
|
||||
launcher:spanY="2"
|
||||
launcher:x="0"
|
||||
launcher:y="0" />
|
||||
|
||||
<folder
|
||||
launcher:container="-100"
|
||||
launcher:screen="0"
|
||||
launcher:title="@string/system_switching"
|
||||
launcher:x="5"
|
||||
launcher:y="2">
|
||||
|
||||
<favorite
|
||||
launcher:className="com.uiui.aios.activity.main.MainActivity"
|
||||
launcher:packageName="com.uiui.aios"
|
||||
launcher:screen="0"
|
||||
launcher:x="0"
|
||||
launcher:y="0" />
|
||||
|
||||
<favorite
|
||||
launcher:className="com.uiui.zyos.activity.main.MainActivity"
|
||||
launcher:packageName="com.uiui.zyos"
|
||||
launcher:screen="0"
|
||||
launcher:x="1"
|
||||
launcher:y="0" />
|
||||
|
||||
<favorite
|
||||
launcher:className="com.cube.setlauncherdef.MainActivity"
|
||||
launcher:icon="@drawable/system_switch"
|
||||
launcher:packageName="com.cube.setlauncherdef"
|
||||
launcher:screen="0"
|
||||
launcher:x="2"
|
||||
launcher:y="0" />
|
||||
|
||||
</folder>
|
||||
|
||||
</favorites>
|
||||
@@ -135,8 +135,8 @@
|
||||
launcher:name="Large Phone"
|
||||
launcher:minWidthDps="406"
|
||||
launcher:minHeightDps="694"
|
||||
launcher:iconImageSize="70"
|
||||
launcher:iconTextSize="14.4"
|
||||
launcher:iconImageSize="90"
|
||||
launcher:iconTextSize="16"
|
||||
launcher:canBeDefault="true" />
|
||||
|
||||
<!-- <display-option-->
|
||||
|
||||
@@ -2552,12 +2552,12 @@ public class CellLayout extends ViewGroup implements Transposable {
|
||||
}
|
||||
|
||||
public int getDesiredWidth() {
|
||||
return getPaddingLeft() + getPaddingRight() + (4 * mCellWidth);
|
||||
return getPaddingLeft() + getPaddingRight() + (3 * mCellWidth);
|
||||
//固定返回文件夹宽度
|
||||
}
|
||||
|
||||
public int getDesiredHeight() {
|
||||
return getPaddingTop() + getPaddingBottom() + (4 * mCellHeight);
|
||||
return getPaddingTop() + getPaddingBottom() + (3 * mCellHeight);
|
||||
//固定返回文件夹高度
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ import com.uiuipad.os.model.AppLaunchTracker;
|
||||
import com.uiuipad.os.model.ModelWriter;
|
||||
import com.uiuipad.os.network.bean.AppPasswdBean;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.HTTPInterface;
|
||||
import com.uiuipad.os.network.NetInterfaceManager;
|
||||
import com.uiuipad.os.network.bean.NewestAppUpdateResult;
|
||||
import com.uiuipad.os.notification.NotificationListener;
|
||||
@@ -156,9 +155,6 @@ import com.uiuipad.os.widget.custom.CustomWidgetParser;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushConfig;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.io.File;
|
||||
@@ -480,25 +476,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
});
|
||||
JGYUtils.getInstance().wakeUpAppstore();
|
||||
JGYUtils.getInstance().wakeUpDeviceInfo();
|
||||
XGPushConfig.enableDebug(this, true);
|
||||
XGPushManager.registerPush(this, new XGIOperateCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object data, int flag) {
|
||||
//token在设备卸载重装的时候有可能会变
|
||||
Log.e("TPush", "注册成功,设备token为:" + data);
|
||||
NetInterfaceManager.getInstance().setPushTag(true, new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(Object data, int errCode, String msg) {
|
||||
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
|
||||
}
|
||||
});
|
||||
PushServiceFactory.init(this);
|
||||
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
|
||||
@@ -1173,43 +1150,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
Log.e("onStart", "app = null" + packageName);
|
||||
return;
|
||||
}
|
||||
sendAppUsageRecord(packageName);
|
||||
}
|
||||
|
||||
private void sendAppUsageRecord(String packageName) {
|
||||
Log.e("sendAppUsageRecord", "packageName: " + packageName);
|
||||
String app_name = APKUtils.getAppNameByPackage(Launcher.this, packageName);
|
||||
long openTime = TimeUtils.getInstance().getStartTime() / 1000;
|
||||
long closeTime = TimeUtils.getInstance().getEndTime() / 1000;
|
||||
NetInterfaceManager.getInstance()
|
||||
.getAppUsageRecordControl()
|
||||
.sendAppUsageRecord(Utils.getSerial(Launcher.this), packageName, app_name, openTime, closeTime)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("sendAppUsageRecord", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("sendAppUsageRecord", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendAppUsageRecord", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("sendAppUsageRecord", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void handleDeferredResume() {
|
||||
if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
|
||||
getUserEventDispatcher().logActionCommand(Action.Command.RESUME,
|
||||
@@ -1286,7 +1228,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
mUpdate.checkUpdate(System.currentTimeMillis());
|
||||
mPasswd.getPassword(System.currentTimeMillis());
|
||||
TimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
HTTPInterface.sendRunningApp(Launcher.this);
|
||||
JGYUtils.getInstance().wakeUpAppstore();
|
||||
JGYUtils.getInstance().wakeUpDeviceInfo();
|
||||
checkIsRest();
|
||||
@@ -1344,7 +1285,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
@Override
|
||||
public void onNext(Long aLong) {
|
||||
Log.e("passwdObserver", "onNext: " + aLong);
|
||||
HTTPInterface.getAppPasswd();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1380,7 +1321,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
@Override
|
||||
public void onNext(Long aLong) {
|
||||
Log.e("updateObserver", "onNext: " + aLong);
|
||||
checkUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1394,77 +1334,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
}
|
||||
};
|
||||
|
||||
private void checkUpdate() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getCheckUpdateObservable()
|
||||
.getCheckUpdate(BuildConfig.APPLICATION_ID,
|
||||
BuildConfig.VERSION_CODE,
|
||||
JGYUtils.getInstance().checkAppPlatform())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse<NewestAppUpdateResult>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("checkUpdate", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<NewestAppUpdateResult> response) {
|
||||
Log.e("checkUpdate", "onNext: " + response);
|
||||
int code = response.code;
|
||||
if (code == 200) {
|
||||
NewestAppUpdateResult result = response.data;
|
||||
checkAppUpdate(result);
|
||||
} else {
|
||||
Log.e(TAG, "onNext: " + "not find update");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("checkUpdate", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("checkUpdate", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkAppUpdate(NewestAppUpdateResult result) {
|
||||
int version_code = result.getVersion_code();
|
||||
String app_package = result.getApp_package();
|
||||
String url = result.getUrl();
|
||||
PackageInfo info = null;
|
||||
try {
|
||||
info = getPackageManager().getPackageInfo(app_package, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = info.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = info.versionCode;
|
||||
}
|
||||
if (info != null && appVersionCode < version_code) {
|
||||
Aria.download(this)
|
||||
.load(url)
|
||||
.setExtendField(result.toString())
|
||||
.setFilePath(ContextCompat.getExternalFilesDirs(Launcher.this, Environment.DIRECTORY_DOWNLOADS)[0].getAbsolutePath() + File.separator + getFileNamefromURL(url))
|
||||
.ignoreFilePathOccupy()
|
||||
.create();
|
||||
} else {
|
||||
Log.e(TAG, "checkAppUpdate: " + app_package + " :无需更新");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFileNamefromURL(String url) {
|
||||
int position = url.lastIndexOf("/");
|
||||
return url.substring(position + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
// Ensure that items added to Launcher are queued until Launcher returns
|
||||
@@ -3067,7 +2936,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
|
||||
// Setting the touch point to (-1, -1) will show the options popup in the center of
|
||||
// the screen.
|
||||
// OptionsPopupView.showDefaultOptions(this, -1, -1);
|
||||
OptionsPopupView.showDefaultOptions(this, -1, -1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ public class ClippedFolderIconLayoutRule {
|
||||
static final int MAX_NUM_ITEMS_IN_PREVIEW = Integer.MAX_VALUE;
|
||||
private static final int MIN_NUM_ITEMS_IN_PREVIEW = 2;
|
||||
|
||||
private static final float MIN_SCALE = 0.16f;
|
||||
private static final float MIN_SCALE = 0.22f;
|
||||
private static final float MAX_SCALE = 0.58f;
|
||||
private static final float MAX_RADIUS_DILATION = 0.15f;
|
||||
private static final float ITEM_RADIUS_SCALE_FACTOR = 1.33f;
|
||||
@@ -55,8 +55,8 @@ public class ClippedFolderIconLayoutRule {
|
||||
// transX = mTmpPoint[0];
|
||||
// transY = mTmpPoint[1];
|
||||
//图标根据大小居中
|
||||
float x = (mAvailableSpace - mIconSize * 4 * MIN_SCALE - 2) / 2;
|
||||
int tempIndex = index % 16;
|
||||
float x = (mAvailableSpace - mIconSize * 3 * MIN_SCALE - 2) / 2;
|
||||
int tempIndex = index % 9;
|
||||
transX = x + mIconSize * MIN_SCALE * getCol(tempIndex) + getCol(tempIndex) * 2;
|
||||
transY = x + mIconSize * MIN_SCALE * (getRow(tempIndex) - 1) + (getRow(tempIndex) - 1) * 2;
|
||||
// Log.e("fht", "transX: "+transX);
|
||||
@@ -79,11 +79,11 @@ public class ClippedFolderIconLayoutRule {
|
||||
|
||||
/* 20180702 modify begin */
|
||||
private int getRow(int index) {
|
||||
return index / 4 + 1;
|
||||
return index / 3 + 1;
|
||||
}
|
||||
|
||||
private int getCol(int index) {
|
||||
return (index) % 4;
|
||||
return (index) % 3;
|
||||
}
|
||||
/* 20180702 modify end */
|
||||
|
||||
@@ -96,11 +96,11 @@ public class ClippedFolderIconLayoutRule {
|
||||
*/
|
||||
private void getGridPosition(int row, int col, float[] result) {
|
||||
// We use position 0 and 3 to calculate the x and y distances between items.
|
||||
getPosition(0, 4, result);
|
||||
getPosition(0, 3, result);
|
||||
float left = result[0];
|
||||
float top = result[1];
|
||||
|
||||
getPosition(3, 4, result);
|
||||
getPosition(3, 3, result);
|
||||
float dx = result[0] - left;
|
||||
float dy = result[1] - top;
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> {
|
||||
InvariantDeviceProfile profile = LauncherAppState.getIDP(context);
|
||||
// mMaxCountX = profile.numFolderColumns;
|
||||
// mMaxCountY = profile.numFolderRows;
|
||||
mMaxCountX = 4;
|
||||
mMaxCountY = 4;
|
||||
mMaxCountX = 3;
|
||||
mMaxCountY = 3;
|
||||
mMaxItemsPerPage = mMaxCountX * mMaxCountY;
|
||||
|
||||
mInflater = LayoutInflater.from(context);
|
||||
@@ -129,9 +129,9 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> {
|
||||
} else {
|
||||
done = false;
|
||||
/* 添加新计算 begin */
|
||||
if(count >4){
|
||||
gridCountX = 4;
|
||||
gridCountY = (count+1)/4 + 1;
|
||||
if(count >3){
|
||||
gridCountX = 3;
|
||||
gridCountY = (count+1)/3 + 1;
|
||||
}else{
|
||||
gridCountX = count;
|
||||
gridCountY =1 ;
|
||||
|
||||
@@ -240,6 +240,7 @@ public class IconCache extends BaseIconCache {
|
||||
this.add("com.android.calendar.AllInOneActivity");//日历
|
||||
this.add("com.android.camera.CameraLauncher");//相机
|
||||
this.add("com.mediatek.camera.CameraLauncher");//相机
|
||||
this.add("com.softwinner.camera.CameraLauncher");//相机
|
||||
this.add("com.android.contacts.activities.PeopleActivity");//通讯录
|
||||
this.add("com.android.deskclock.DeskClock");//时钟
|
||||
this.add("com.android.dialer.DialtactsActivity");//电话
|
||||
@@ -247,6 +248,7 @@ public class IconCache extends BaseIconCache {
|
||||
this.add("com.android.dialer.main.impl.MainActivity");//电话
|
||||
this.add("com.android.gallery3d.v2.app.GalleryActivity2");//图库
|
||||
this.add("com.android.gallery3d.app.GalleryActivity");//图库
|
||||
this.add("com.google.android.apps.photos.home.HomeActivity");//图库
|
||||
this.add("com.android.messaging.ui.conversationlist.ConversationListActivity");//信息
|
||||
this.add("com.android.music.MusicBrowserActivity");//音乐
|
||||
this.add("com.android.providers.downloads.ui.DownloadList");//下载
|
||||
@@ -256,11 +258,17 @@ public class IconCache extends BaseIconCache {
|
||||
this.add("com.android.soundrecorder.SoundRecorder");//录音机
|
||||
this.add("com.android.stk.StkMain");//sim卡
|
||||
this.add("com.sprd.gallery3d.app.NewVideoActivity");//视频
|
||||
this.add("com.softwinner.videoplayer.view.activity.HomePageActivity");//视频
|
||||
this.add("com.mediatek.filemanager.FileManagerOperationActivity");//文件管理
|
||||
this.add("com.google.android.apps.nbu.files.home.HomeActivity");//文件管理
|
||||
this.add("com.android.documentsui.LauncherActivity");//下载
|
||||
this.add("com.mediatek.fmradio.FmRadioActivity");//收音机
|
||||
this.add("com.android.fmradio.FmMainActivity");//收音机
|
||||
this.add("com.android.email.activity.Welcome");//电子邮件
|
||||
this.add("com.uiui.aios.activity.main.MainActivity");//学习桌面
|
||||
this.add("com.uiui.zyos.activity.main.MainActivity");//学习桌面
|
||||
this.add("com.android.permissioncontroller.role.ui.DefaultAppActivity");//系统切换
|
||||
this.add("com.cube.setlauncherdef.MainActivity");//系统切换
|
||||
}};
|
||||
private List<String> appIconList = new ArrayList<String>() {{
|
||||
this.add("com_android_appstore");
|
||||
@@ -271,6 +279,7 @@ public class IconCache extends BaseIconCache {
|
||||
this.add("com_android_calendar");
|
||||
this.add("com_android_camera");
|
||||
this.add("com_android_camera");
|
||||
this.add("com_android_camera");
|
||||
this.add("com_android_contacts");
|
||||
this.add("com_android_deskclock");
|
||||
this.add("com_android_dialer");
|
||||
@@ -278,6 +287,7 @@ public class IconCache extends BaseIconCache {
|
||||
this.add("com_android_dialer");
|
||||
this.add("com_android_gallery3d_app");
|
||||
this.add("com_android_gallery3d_app");
|
||||
this.add("com_android_gallery3d_app");
|
||||
this.add("com_android_mms_ui");
|
||||
this.add("com_android_music");
|
||||
this.add("com_android_providers_downloads_ui");
|
||||
@@ -287,11 +297,17 @@ public class IconCache extends BaseIconCache {
|
||||
this.add("com_android_soundrecorder");
|
||||
this.add("com_android_stk_stkmain");
|
||||
this.add("com_android_vdieo");
|
||||
this.add("com_android_vdieo");
|
||||
this.add("com_mediatek_filemanager");
|
||||
this.add("com_mediatek_filemanager");
|
||||
this.add("com_mediatek_filemanager");
|
||||
this.add("com_mediatek_fmradio");
|
||||
this.add("com_mediatek_fmradio");//收音机
|
||||
this.add("com_android_email");
|
||||
this.add("com_uiui_aios");
|
||||
this.add("com_uiui_zyos");
|
||||
this.add("system_switch");
|
||||
this.add("system_switch");
|
||||
}};
|
||||
|
||||
public Drawable getFullResIcon(LauncherActivityInfo info) {
|
||||
|
||||
@@ -268,46 +268,33 @@ public class LoaderTask implements Runnable {
|
||||
* 系统应用只显示这几个
|
||||
*/
|
||||
public static HashSet<String> showApp = new HashSet<String>() {{
|
||||
// this.add(BuildConfig.APPLICATION_ID);
|
||||
//aoleyun
|
||||
// this.add("com.aoleyun.sn");
|
||||
this.add("com.aoleyun.appstore");
|
||||
this.add("com.aoleyun.postern");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.aoleyun.info");
|
||||
this.add("com.aoleyun.file");
|
||||
this.add("com.aoleyun.reos");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
//system
|
||||
this.add("com.uiuipad.find");
|
||||
this.add("com.uiuipad.browser");
|
||||
this.add("com.uiui.aios");
|
||||
this.add("com.uiui.zyos");
|
||||
|
||||
this.add("com.android.dialer");
|
||||
this.add("com.android.messaging");
|
||||
this.add("com.android.contacts");
|
||||
this.add("com.android.documentsui");
|
||||
// this.add("com.android.messaging");
|
||||
this.add("com.android.music");
|
||||
this.add("com.android.calendar");
|
||||
this.add("com.android.gallery3d");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.android.camera");
|
||||
this.add("com.android.camera2");
|
||||
this.add("com.android.calculator");
|
||||
this.add("com.android.calculator2");
|
||||
this.add("com.android.settings");
|
||||
this.add("com.android.stk");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.mediatek.filemanager");
|
||||
//uiui
|
||||
this.add("com.calculator.uiui");
|
||||
this.add("com.notepad.uiui");
|
||||
this.add("com.calendar.uiui");
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.uiui.videoplayer");
|
||||
//aihua
|
||||
this.add("com.liuyang.jcstudentside");
|
||||
this.add("com.alibaba.android.rimet");
|
||||
this.add("com.tencent.wemeet.app");
|
||||
this.add("com.qi.studycomputer.launcher");
|
||||
|
||||
this.add("com.softwinner.camera");
|
||||
this.add("com.google.android.apps.photos");
|
||||
this.add("com.android.calculator2");
|
||||
this.add("com.android.soundrecorder");
|
||||
this.add("com.google.android.deskclock");
|
||||
this.add("com.softwinner.videoplayer");
|
||||
this.add("com.google.android.apps.nbu.files");
|
||||
this.add("com.android.permissioncontroller");
|
||||
// this.add("");
|
||||
}};
|
||||
|
||||
//add for load all app on workspace
|
||||
@@ -331,26 +318,26 @@ public class LoaderTask implements Runnable {
|
||||
)
|
||||
continue;
|
||||
/*系统应用*/
|
||||
if (JGYUtils.getInstance().getDeviceIsLocked() && aihuaUnlock != 1) {
|
||||
if ((app.getApplicationFlags() & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
if (!showApp.contains(app.getApplicationInfo().packageName)) {
|
||||
Log.e("verifyApplications", "skip1: " + app.getApplicationInfo().packageName);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (TextUtils.isEmpty(whiteList)) {
|
||||
if (!showApp.contains(app.getApplicationInfo().packageName)) {
|
||||
Log.e("verifyApplications", "skip2: " + app.getApplicationInfo().packageName);
|
||||
continue;
|
||||
}
|
||||
} else if (!whiteList.contains(app.getApplicationInfo().packageName)) {
|
||||
if (!showApp.contains(app.getApplicationInfo().packageName)) {
|
||||
Log.e("verifyApplications", "skip3: " + app.getApplicationInfo().packageName);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (JGYUtils.getInstance().getDeviceIsLocked() && aihuaUnlock != 1) {
|
||||
// if ((app.getApplicationFlags() & ApplicationInfo.FLAG_SYSTEM) == 1) {
|
||||
// if (!showApp.contains(app.getApplicationInfo().packageName)) {
|
||||
// Log.e("verifyApplications", "skip1: " + app.getApplicationInfo().packageName);
|
||||
// continue;
|
||||
// }
|
||||
// } else {
|
||||
// if (TextUtils.isEmpty(whiteList)) {
|
||||
// if (!showApp.contains(app.getApplicationInfo().packageName)) {
|
||||
// Log.e("verifyApplications", "skip2: " + app.getApplicationInfo().packageName);
|
||||
// continue;
|
||||
// }
|
||||
// } else if (!whiteList.contains(app.getApplicationInfo().packageName)) {
|
||||
// if (!showApp.contains(app.getApplicationInfo().packageName)) {
|
||||
// Log.e("verifyApplications", "skip3: " + app.getApplicationInfo().packageName);
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Log.e("verifyApplications", "AddApp: " + app.getApplicationInfo().packageName);
|
||||
InstallShortcutReceiver.PendingInstallShortcutInfo pendingInstallShortcutInfo = new InstallShortcutReceiver.PendingInstallShortcutInfo(app, context);
|
||||
added.add(pendingInstallShortcutInfo);
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.uiuipad.os.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiuipad.os.network.bean.AppPasswdBean;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.uiuiutils.APKUtils;
|
||||
import com.uiuipad.os.uiuiutils.TimeUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @author : fanhuitong
|
||||
* e-mail :
|
||||
* @date : 2021/10/27 15:31
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public class HTTPInterface {
|
||||
private static final String TAG = HTTPInterface.class.getSimpleName();
|
||||
|
||||
public static void getAppPasswd() {
|
||||
NetInterfaceManager.getInstance().getAppPasswordObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AppPasswdBean>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getAppPasswd", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AppPasswdBean>> listBaseResponse) {
|
||||
Log.e("getAppPasswd", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppPasswdBean> beanList = listBaseResponse.data;
|
||||
String jsonString = JsonParser.parseString(new Gson().toJson(beanList)).getAsJsonArray().toString();
|
||||
MMKV.defaultMMKV().encode("ApplicationLock", jsonString);
|
||||
Log.e("getAppPasswd", "onNext: " + jsonString);
|
||||
} else {
|
||||
MMKV.defaultMMKV().encode("ApplicationLock", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAppPasswd", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppPasswd", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送正在运行的app信息
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void sendRunningApp(Context context) {
|
||||
String packageName = TimeUtils.getInstance().getAppPackageName();
|
||||
Log.e("SendRunningApp", "packageName: " + packageName);
|
||||
long time = TimeUtils.getInstance().getStartTime();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("app_package", packageName);
|
||||
jsonObject.addProperty("version_name", APKUtils.getAPPVersionName(context, packageName));
|
||||
jsonObject.addProperty("run_time", time / 1000);
|
||||
jsonObject.addProperty("app_name", APKUtils.getAppNameByPackage(context, packageName));
|
||||
jsonObject.addProperty("status", 1);
|
||||
String jsonString = jsonObject.toString();
|
||||
NetInterfaceManager.getInstance().getRunningAppObservable(jsonString)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("SendRunningApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("SendRunningApp", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendRunningApp", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SendRunningApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// private static void setTag(Context context, Set set) {
|
||||
// TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||
// tagAliasBean.action = ACTION_SET;
|
||||
// sequence++;
|
||||
// tagAliasBean.tags = set;
|
||||
// tagAliasBean.isAliasAction = false;
|
||||
// TagAliasOperatorHelper.getInstance().handleAction(context, sequence, tagAliasBean);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -2,45 +2,27 @@ package com.uiuipad.os.network;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.sdk.android.push.CloudPushService;
|
||||
import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.uiuipad.os.disklrucache.CacheHelper;
|
||||
import com.uiuipad.os.manager.ConnectManager;
|
||||
import com.uiuipad.os.manager.ConnectMode;
|
||||
import com.uiuipad.os.network.api.AddAppLog;
|
||||
import com.uiuipad.os.network.api.AppUsageRecordApi;
|
||||
import com.uiuipad.os.network.api.CheckUpdate;
|
||||
import com.uiuipad.os.network.api.GetAppPassword;
|
||||
import com.uiuipad.os.network.api.GetPushTagsApi;
|
||||
import com.uiuipad.os.network.api.RunningApp;
|
||||
import com.uiuipad.os.network.api.SendScreenshotApi;
|
||||
import com.uiuipad.os.network.bean.AppPasswdBean;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.bean.Batch;
|
||||
import com.uiuipad.os.network.interceptor.RepeatRequestInterceptor;
|
||||
import com.uiuipad.os.uiuiutils.JGYUtils;
|
||||
import com.uiuipad.os.uiuiutils.Utils;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiuipad.os.disklrucache.CacheHelper;
|
||||
import com.uiuipad.os.network.api.CloudLessonAppApi;
|
||||
import com.uiuipad.os.network.api.CloudLessonSettingApi;
|
||||
import com.uiuipad.os.network.api.TimeManageAppApi;
|
||||
import com.uiuipad.os.network.api.TimeManageSnApi;
|
||||
import com.uiuipad.os.network.api.UploadAppUseLogApi;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.bean.TimeManageApp;
|
||||
import com.uiuipad.os.network.bean.TimeManageSn;
|
||||
import com.uiuipad.os.network.interceptor.RepeatRequestInterceptor;
|
||||
import com.uiuipad.os.uiuiutils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
@@ -112,162 +94,39 @@ public class NetInterfaceManager {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
public Observable<BaseResponse> getRunningAppObservable(String json) {
|
||||
return mRetrofit.create(RunningApp.class)
|
||||
.sendRunningInfo(Utils.getSerial(mContext), json)
|
||||
public Observable<BaseResponse> getCloudLessonSettingObservable() {
|
||||
return mRetrofit.create(CloudLessonSettingApi.class)
|
||||
.getCloudLessonSetting(Utils.getSerial(mContext))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AppPasswdBean>>> getAppPasswordObservable() {
|
||||
return mRetrofit.create(GetAppPassword.class)
|
||||
.getAppPasswd(Utils.getSerial(mContext))
|
||||
public Observable<BaseResponse> getCloudLessonAppObservable() {
|
||||
return mRetrofit.create(CloudLessonAppApi.class)
|
||||
.getCloudLessonApp(Utils.getSerial(mContext))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public SendScreenshotApi getScreenshotApi() {
|
||||
return mRetrofit.create(SendScreenshotApi.class);
|
||||
}
|
||||
|
||||
public AddAppLog getapplogControl() {
|
||||
return mRetrofit.create(AddAppLog.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取极光推送的tag
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Observable<BaseResponse<Batch>> getPushTagsObservable() {
|
||||
return mRetrofit.create(GetPushTagsApi.class)
|
||||
.getPushTags(Utils.getSerial(mContext))
|
||||
public Observable<BaseResponse> getUploadAppUseLogObservable(Map<String, String> params) {
|
||||
return mRetrofit.create(UploadAppUseLogApi.class)
|
||||
.uploadAppUseLog(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
public AppUsageRecordApi getAppUsageRecordControl() {
|
||||
return mRetrofit.create(AppUsageRecordApi.class);
|
||||
public Observable<BaseResponse<TimeManageSn>> getTimeManageSnObservable() {
|
||||
return mRetrofit.create(TimeManageSnApi.class)
|
||||
.getTimeManageSn(Utils.getSerial(mContext))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public CheckUpdate getCheckUpdateObservable() {
|
||||
return mRetrofit.create(CheckUpdate.class);
|
||||
public Observable<BaseResponse<List<TimeManageApp>>> getTimeManageAppObservable() {
|
||||
return mRetrofit.create(TimeManageAppApi.class)
|
||||
.getTimeManageSn(Utils.getSerial(mContext))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
public interface onCompleteCallback {
|
||||
void onComplete();
|
||||
}
|
||||
|
||||
public void setPushTag(boolean refresh, onCompleteCallback callback) {
|
||||
ConnectMode connectMode = ConnectMode.TWO_DAY;
|
||||
if (refresh) {
|
||||
connectMode = ConnectMode.ONE_DAY;
|
||||
}
|
||||
if (ConnectManager.getInstance().isNeedConnect(UrlAddress.GET_DEVICES_TAGS, connectMode)) {
|
||||
setPushTag(callback);
|
||||
} else {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_DEVICES_TAGS);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
setPushTag(callback);
|
||||
} else {
|
||||
Set tagSets = mMMKV.decodeStringSet(UrlAddress.GET_DEVICES_TAGS + "pushset");
|
||||
Log.e("setPushTags", "tagSets: " + tagSets);
|
||||
clearAndAppendTags(tagSets);
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPushTag(onCompleteCallback callback) {
|
||||
Set set = new HashSet();
|
||||
JGYUtils.getInstance().getAppPlatform(new JGYUtils.GetAppPlatformCallback() {
|
||||
@Override
|
||||
public void AppPlatform(int platform) {
|
||||
if (platform == JGYUtils.MTKPlatform) {
|
||||
set.add(JGYUtils.MTKTag);
|
||||
} else if (platform == JGYUtils.ZhanruiPlatform) {
|
||||
set.add(JGYUtils.ZhanruiTag);
|
||||
} else if (platform == JGYUtils.CubePlatform) {
|
||||
set.add(JGYUtils.CubeTag);
|
||||
} else if (platform == JGYUtils.MTK11Platform) {
|
||||
set.add(JGYUtils.MTK11Tag);
|
||||
} else if (platform == JGYUtils.TeclastP20sPlatform) {
|
||||
set.add(JGYUtils.TeclastP20sTag);
|
||||
} else if (platform == JGYUtils.AH6016Platform) {
|
||||
set.add(JGYUtils.AH6016Tag);
|
||||
}else if (platform == JGYUtils.ZR6016Platform) {
|
||||
set.add(JGYUtils.ZR6016Tag);
|
||||
}
|
||||
}
|
||||
});
|
||||
getPushTagsObservable()
|
||||
.subscribe(new Observer<BaseResponse<Batch>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("setPushTag", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<Batch> response) {
|
||||
Log.e("setPushTag", "onNext: " + response);
|
||||
if (response.code == 200) {
|
||||
String batch = response.data.getBatch();
|
||||
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, batch);
|
||||
if (!TextUtils.isEmpty(batch)) {
|
||||
set.add(batch);
|
||||
} else {
|
||||
Log.e("setPushTag", "onNext: " + "batch empty");
|
||||
}
|
||||
} else {
|
||||
cacheHelper.put(UrlAddress.GET_DEVICES_TAGS, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("setPushTag", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("setPushTag", "onComplete: ");
|
||||
mMMKV.encode(UrlAddress.GET_DEVICES_TAGS + "pushset", set);
|
||||
clearAndAppendTags(set);
|
||||
callback.onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
synchronized private void clearAndAppendTags(Set<String> tagSets) {
|
||||
XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), tagSets, new XGIOperateCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object o, int i) {
|
||||
Log.e("clearAndAppendTags", "onSuccess: " + o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(Object o, int i, String s) {
|
||||
Log.e("clearAndAppendTags", "onFail: " + o);
|
||||
}
|
||||
});
|
||||
String[] tag = new ArrayList<>(tagSets).toArray(new String[tagSets.size()]);
|
||||
CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||
pushService.bindTag(CloudPushService.DEVICE_TARGET, tag, null, new CommonCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " success\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorCode, String errorMsg) {
|
||||
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " failed." +
|
||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
package com.uiuipad.os.network;
|
||||
|
||||
public class UrlAddress {
|
||||
public static final String ROOT_URL = "https://led.aoleyun.cn/api/";
|
||||
public static final String APP_LOG = "app/addAppLog";
|
||||
//获取正在运行的app
|
||||
public static final String RUN_NEW_APP = "And/runNewApp";
|
||||
//更新
|
||||
public final static String GET_NEWESTAPPUPDATE = "Silent/silent";
|
||||
//是否有应用密码锁
|
||||
public final static String GET_APP_ISLOCKED = "And/isApplicationLock";
|
||||
//验证应用密码锁
|
||||
public final static String CHECK_APP_PASSWD = "And/checkApplicationLock";
|
||||
//获取所有应用密码
|
||||
public final static String GET_APP_PASSWD = "And/getApplicationLock";
|
||||
//获取设备标签
|
||||
public static final String GET_DEVICES_TAGS = "Sn/getSnTag";
|
||||
//发送app使用时长
|
||||
public static final String SEND_APP_RECORD = "And/appUsageRecord";
|
||||
//上传截图
|
||||
public static final String SEND_SCREENSHOT = "Screenshot/addImg";
|
||||
public static final String ROOT_URL = "https://kxapi.uiuios.com/android/";
|
||||
|
||||
/*上传应用使用记录*/
|
||||
public static final String UPLOAD_APP_USE_LOG = "app/app/uploadAppUseLog";
|
||||
|
||||
/*获取专注模式设置*/
|
||||
@Deprecated
|
||||
public static final String GET_CLOUD_LESSON_SETTING = "equipment/manage/getCloudLessonSetting";
|
||||
/*获取专注模式应用*/
|
||||
@Deprecated
|
||||
public static final String GET_CLOUD_LESSON_APP = "equipment/manage/getCloudLessonApp";
|
||||
/*
|
||||
* 时间管控
|
||||
* */
|
||||
/*获取整机时间管控*/
|
||||
public static final String GET_TIME_MANAGE_SN = "equipment/timeManage/getTimeManageSn";
|
||||
/*获取应用时间管控*/
|
||||
public static final String GET_TIME_MANAGE_APP = "equipment/timeManage/getTimeManageApp";
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface AddAppLog {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.APP_LOG)
|
||||
Observable<BaseResponse> addLog(
|
||||
@Field("sn") String sn,
|
||||
@Field("packageName") String packageName,
|
||||
@Field("versionCode") long versionCode,
|
||||
@Field("createTime") long createTime,
|
||||
@Field("type") long type
|
||||
);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface AppUsageRecordApi {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.SEND_APP_RECORD)
|
||||
Observable<BaseResponse> sendAppUsageRecord(
|
||||
@Field("sn") String sn,
|
||||
@Field("app_package") String app_package,
|
||||
@Field("app_name") String app_name,
|
||||
@Field("open_time") long open_time,
|
||||
@Field("close_time") long close_time
|
||||
);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.bean.NewestAppUpdateResult;
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface CheckUpdate {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.GET_NEWESTAPPUPDATE)
|
||||
Observable<BaseResponse<NewestAppUpdateResult>> getCheckUpdate(
|
||||
@Field("package")String packageName,
|
||||
@Field("versionCode")int versionCode,
|
||||
@Field("type")int type
|
||||
);
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
import com.uiuipad.os.network.bean.Batch;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GetPushTagsApi {
|
||||
@GET(UrlAddress.GET_DEVICES_TAGS)
|
||||
Observable<BaseResponse<Batch>> getPushTags(
|
||||
public interface CloudLessonAppApi {
|
||||
@GET(UrlAddress.GET_CLOUD_LESSON_APP)
|
||||
Observable<BaseResponse> getCloudLessonApp(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
15
src/com/uiuipad/os/network/api/CloudLessonSettingApi.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface CloudLessonSettingApi {
|
||||
@GET(UrlAddress.GET_CLOUD_LESSON_SETTING)
|
||||
Observable<BaseResponse> getCloudLessonSetting(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
public interface SendScreenshotApi {
|
||||
@Multipart
|
||||
@POST(UrlAddress.SEND_SCREENSHOT)
|
||||
Observable<BaseResponse> sendScreenshot(
|
||||
@QueryMap Map<String, String> params,
|
||||
@Part MultipartBody.Part body
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.bean.AppPasswdBean;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.bean.TimeManageApp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,16 +10,9 @@ import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* @author : fanhuitong
|
||||
* e-mail :
|
||||
* @date : 2021/10/22 18:06
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public interface GetAppPassword {
|
||||
@GET(UrlAddress.GET_APP_PASSWD)
|
||||
Observable<BaseResponse<List<AppPasswdBean>>> getAppPasswd(
|
||||
public interface TimeManageAppApi {
|
||||
@GET(UrlAddress.GET_TIME_MANAGE_APP)
|
||||
Observable<BaseResponse<List<TimeManageApp>>> getTimeManageSn(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
16
src/com/uiuipad/os/network/api/TimeManageSnApi.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.bean.TimeManageSn;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface TimeManageSnApi {
|
||||
@GET(UrlAddress.GET_TIME_MANAGE_SN)
|
||||
Observable<BaseResponse<TimeManageSn>> getTimeManageSn(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
package com.uiuipad.os.network.api;
|
||||
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
import com.uiuipad.os.network.UrlAddress;
|
||||
import com.uiuipad.os.network.bean.BaseResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.PartMap;
|
||||
|
||||
public interface RunningApp {
|
||||
public interface UploadAppUseLogApi {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.RUN_NEW_APP)
|
||||
Observable<BaseResponse> sendRunningInfo(
|
||||
@Field("sn") String sn,
|
||||
@Field("app") String app
|
||||
@POST(UrlAddress.UPLOAD_APP_USE_LOG)
|
||||
Observable<BaseResponse> uploadAppUseLog(
|
||||
@PartMap Map<String, String> params
|
||||
);
|
||||
}
|
||||
72
src/com/uiuipad/os/network/bean/TimeManageApp.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.uiuipad.os.network.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class TimeManageApp implements Serializable {
|
||||
private static final long serialVersionUID = 8994636991878020624L;
|
||||
|
||||
String app_package;
|
||||
int class_id;
|
||||
int use_type;
|
||||
long work_time;
|
||||
long rest_time;
|
||||
long today_time;
|
||||
List<TimeManagePart> time_part;
|
||||
|
||||
public String getApp_package() {
|
||||
return app_package;
|
||||
}
|
||||
|
||||
public void setApp_package(String app_package) {
|
||||
this.app_package = app_package;
|
||||
}
|
||||
|
||||
public int getClass_id() {
|
||||
return class_id;
|
||||
}
|
||||
|
||||
public void setClass_id(int class_id) {
|
||||
this.class_id = class_id;
|
||||
}
|
||||
|
||||
public int getUse_type() {
|
||||
return use_type;
|
||||
}
|
||||
|
||||
public void setUse_type(int use_type) {
|
||||
this.use_type = use_type;
|
||||
}
|
||||
|
||||
public long getWork_time() {
|
||||
return work_time;
|
||||
}
|
||||
|
||||
public void setWork_time(long work_time) {
|
||||
this.work_time = work_time;
|
||||
}
|
||||
|
||||
public long getRest_time() {
|
||||
return rest_time;
|
||||
}
|
||||
|
||||
public void setRest_time(long rest_time) {
|
||||
this.rest_time = rest_time;
|
||||
}
|
||||
|
||||
public long getToday_time() {
|
||||
return today_time;
|
||||
}
|
||||
|
||||
public void setToday_time(long today_time) {
|
||||
this.today_time = today_time;
|
||||
}
|
||||
|
||||
public List<TimeManagePart> getTime_part() {
|
||||
return time_part;
|
||||
}
|
||||
|
||||
public void setTime_part(List<TimeManagePart> time_part) {
|
||||
this.time_part = time_part;
|
||||
}
|
||||
}
|
||||
35
src/com/uiuipad/os/network/bean/TimeManagePart.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.uiuipad.os.network.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TimeManagePart implements Serializable {
|
||||
private static final long serialVersionUID = -3944199351838956883L;
|
||||
|
||||
String start_time;
|
||||
String end_time;
|
||||
int day_type;
|
||||
|
||||
public String getStart_time() {
|
||||
return start_time;
|
||||
}
|
||||
|
||||
public void setStart_time(String start_time) {
|
||||
this.start_time = start_time;
|
||||
}
|
||||
|
||||
public String getEnd_time() {
|
||||
return end_time;
|
||||
}
|
||||
|
||||
public void setEnd_time(String end_time) {
|
||||
this.end_time = end_time;
|
||||
}
|
||||
|
||||
public int getDay_type() {
|
||||
return day_type;
|
||||
}
|
||||
|
||||
public void setDay_type(int day_type) {
|
||||
this.day_type = day_type;
|
||||
}
|
||||
}
|
||||
45
src/com/uiuipad/os/network/bean/TimeManageSn.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.uiuipad.os.network.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class TimeManageSn implements Serializable {
|
||||
private static final long serialVersionUID = 7571406354160374162L;
|
||||
|
||||
long work_time;
|
||||
long rest_time;
|
||||
long today_time;
|
||||
List<TimeManagePart> time_part;
|
||||
|
||||
public long getWork_time() {
|
||||
return work_time;
|
||||
}
|
||||
|
||||
public void setWork_time(long work_time) {
|
||||
this.work_time = work_time;
|
||||
}
|
||||
|
||||
public long getRest_time() {
|
||||
return rest_time;
|
||||
}
|
||||
|
||||
public void setRest_time(long rest_time) {
|
||||
this.rest_time = rest_time;
|
||||
}
|
||||
|
||||
public long getToday_time() {
|
||||
return today_time;
|
||||
}
|
||||
|
||||
public void setToday_time(long today_time) {
|
||||
this.today_time = today_time;
|
||||
}
|
||||
|
||||
public List<TimeManagePart> getTime_part() {
|
||||
return time_part;
|
||||
}
|
||||
|
||||
public void setTime_part(List<TimeManagePart> time_part) {
|
||||
this.time_part = time_part;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package com.uiuipad.os.push;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
import com.uiuipad.os.network.HTTPInterface;
|
||||
|
||||
public class PushManager {
|
||||
private static final String TAG = PushManager.class.getSimpleName();
|
||||
|
||||
@@ -38,7 +36,6 @@ public class PushManager {
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
case UPDATEPASSWD:
|
||||
HTTPInterface.getAppPasswd();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.uiuipad.os.push.tpush;
|
||||
|
||||
/**
|
||||
* Created by chacewang on 2019/7/5.
|
||||
*/
|
||||
|
||||
public class Constants {
|
||||
public static final int TEST_LOCAL_NOTIFICATION = 1;
|
||||
public static final int TEST_NOTIFICATION = 2;
|
||||
public static final int TEST_SET_TAG = 3;
|
||||
public static final int TEST_DEL_TAG = 4;
|
||||
public static final int TEST_SET_ACCOUNT = 5;
|
||||
public static final int TEST_DEL_ACCOUNT = 6;
|
||||
|
||||
public static final String LOCAL_NOTIFICATION_TITLE = "localtest";
|
||||
public static final String TEST_TAG_NAME = "DiagnosisTag";
|
||||
}
|
||||
@@ -1,296 +0,0 @@
|
||||
package com.uiuipad.os.push.tpush;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.uiuipad.os.push.PushManager;
|
||||
import com.uiuipad.os.push.tpush.common.NotificationService;
|
||||
import com.uiuipad.os.push.tpush.po.XGNotification;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.tencent.android.tpush.NotificationAction;
|
||||
import com.tencent.android.tpush.XGPushBaseReceiver;
|
||||
import com.tencent.android.tpush.XGPushClickedResult;
|
||||
import com.tencent.android.tpush.XGPushRegisterResult;
|
||||
import com.tencent.android.tpush.XGPushShowedResult;
|
||||
import com.tencent.android.tpush.XGPushTextMessage;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class MessageReceiver extends XGPushBaseReceiver {
|
||||
private static final String TAG = MessageReceiver.class.getSimpleName();
|
||||
|
||||
public static final String UPDATE_LISTVIEW_ACTION = "com.qq.xgdemo.activity.UPDATE_LISTVIEW";
|
||||
public static final String TEST_ACTION = "com.qq.xgdemo.activity.TEST_ACTION";
|
||||
public static final String LogTag = "xg.test";
|
||||
|
||||
/**
|
||||
* 消息透传处理
|
||||
*
|
||||
* @param context
|
||||
* @param message 解析自定义的 JSON
|
||||
*/
|
||||
@Override
|
||||
public void onTextMessage(Context context, XGPushTextMessage message) {
|
||||
String text = "收到消息:" + message.toString();
|
||||
// 获取自定义key-value
|
||||
String customContent = message.getCustomContent();
|
||||
if (customContent != null && customContent.length() != 0) {
|
||||
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
|
||||
// key1为前台配置的key
|
||||
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
|
||||
String value = obj.get("key").getAsString();
|
||||
Log.d(LogTag, "get custom value:" + value);
|
||||
}
|
||||
// ...
|
||||
}
|
||||
// APP自主处理消息的过程...
|
||||
Log.e(LogTag, text);
|
||||
show(context, text);
|
||||
processCustomMessage(context, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知展示
|
||||
*
|
||||
* @param context
|
||||
* @param notifiShowedRlt 包含通知的内容
|
||||
*/
|
||||
@Override
|
||||
public void onNotificationShowedResult(Context context, XGPushShowedResult notifiShowedRlt) {
|
||||
if (context == null || notifiShowedRlt == null) {
|
||||
return;
|
||||
}
|
||||
XGNotification notific = new XGNotification();
|
||||
notific.setMsg_id(notifiShowedRlt.getMsgId());
|
||||
notific.setTitle(notifiShowedRlt.getTitle());
|
||||
notific.setContent(notifiShowedRlt.getContent());
|
||||
// notificationActionType==1为Activity,2为url,3为intent
|
||||
notific.setNotificationActionType(notifiShowedRlt
|
||||
.getNotificationActionType());
|
||||
// Activity,url,intent都可以通过getActivity()获得
|
||||
notific.setActivity(notifiShowedRlt.getActivity());
|
||||
notific.setUpdate_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
.format(Calendar.getInstance().getTime()));
|
||||
NotificationService.getInstance(context).save(notific);
|
||||
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
if (notifiShowedRlt.getTitle().equals(Constants.LOCAL_NOTIFICATION_TITLE)) {
|
||||
testIntent.putExtra("step", Constants.TEST_LOCAL_NOTIFICATION);
|
||||
} else {
|
||||
testIntent.putExtra("step", Constants.TEST_NOTIFICATION);
|
||||
}
|
||||
context.sendBroadcast(testIntent);
|
||||
|
||||
Intent viewIntent = new Intent(UPDATE_LISTVIEW_ACTION);
|
||||
context.sendBroadcast(viewIntent);
|
||||
show(context, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString());
|
||||
Log.d(LogTag, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString() + ", PushChannel:" + notifiShowedRlt.getPushChannel());
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
*/
|
||||
@Override
|
||||
public void onRegisterResult(Context context, int errorCode, XGPushRegisterResult message) {
|
||||
if (context == null || message == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
// 在这里拿token
|
||||
String token = message.getToken();
|
||||
text = "注册成功1. token:" + token;
|
||||
} else {
|
||||
text = message + "注册失败,错误码:" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反注册回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
*/
|
||||
@Override
|
||||
public void onUnregisterResult(Context context, int errorCode) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
text = "反注册成功";
|
||||
} else {
|
||||
text = "反注册失败" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置标签回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param tagName 设置的 TAG
|
||||
*/
|
||||
@Override
|
||||
public void onSetTagResult(Context context, int errorCode, String tagName) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
text = "\"" + tagName + "\"设置成功";
|
||||
} else {
|
||||
text = "\"" + tagName + "\"设置失败,错误码:" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_SET_TAG);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除标签的回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param tagName 设置的 TAG
|
||||
*/
|
||||
@Override
|
||||
public void onDeleteTagResult(Context context, int errorCode, String tagName) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
text = "\"" + tagName + "\"删除成功";
|
||||
} else {
|
||||
text = "\"" + tagName + "\"删除失败,错误码:" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_DEL_TAG);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置账号回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param account 设置的账号
|
||||
*/
|
||||
@Override
|
||||
public void onSetAccountResult(Context context, int errorCode, String account) {
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_SET_ACCOUNT);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除账号回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param account 设置的账号
|
||||
*/
|
||||
@Override
|
||||
public void onDeleteAccountResult(Context context, int errorCode, String account) {
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_DEL_ACCOUNT);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetAttributeResult(Context context, int i, String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteAttributeResult(Context context, int i, String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueryTagsResult(Context context, int errorCode, String data, String operateName) {
|
||||
Log.i(LogTag, "action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知点击回调 actionType=1为该消息被清除,actionType=0为该消息被点击
|
||||
*
|
||||
* @param context
|
||||
* @param message 包含被点击通知的内容
|
||||
*/
|
||||
@Override
|
||||
public void onNotificationClickedResult(Context context, XGPushClickedResult message) {
|
||||
if (context == null || message == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (message.getActionType() == NotificationAction.clicked.getType()) {
|
||||
// 通知在通知栏被点击啦。。。。。
|
||||
// APP自己处理点击的相关动作
|
||||
// 这个动作可以在activity的onResume也能监听,请看第3点相关内容
|
||||
text = "通知被打开 :" + message;
|
||||
} else if (message.getActionType() == NotificationAction.delete.getType()) {
|
||||
// 通知被清除啦。。。。
|
||||
// APP自己处理通知被清除后的相关动作
|
||||
text = "通知被清除 :" + message;
|
||||
}
|
||||
Toast.makeText(context, "广播接收到通知被点击:" + message.toString(),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
// 获取自定义key-value
|
||||
String customContent = message.getCustomContent();
|
||||
if (customContent != null && customContent.length() != 0) {
|
||||
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
|
||||
// key1为前台配置的key
|
||||
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
|
||||
String value = obj.get("key").getAsString();
|
||||
Log.d(LogTag, "get custom value:" + value);
|
||||
}
|
||||
// ...
|
||||
}
|
||||
// APP自主处理的过程。。。
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
}
|
||||
|
||||
private void show(Context context, String text) {
|
||||
// Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void processCustomMessage(Context context, XGPushTextMessage message) {
|
||||
if (context == null || message == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String title = message.getTitle();
|
||||
String content = message.getContent();
|
||||
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
|
||||
|
||||
String extras = "";
|
||||
if (extrasJson.get("extras") != null) {
|
||||
extras = extrasJson.get("extras").toString();
|
||||
}
|
||||
PushManager.getInstance().setPushContent(title, extras);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.uiuipad.os.push.tpush.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
public class DBOpenHelper extends SQLiteOpenHelper {
|
||||
|
||||
public DBOpenHelper(Context context) {
|
||||
super(context, "XGExample.db", null, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
db.execSQL("CREATE TABLE notification (id integer primary key autoincrement,msg_id varchar(64),title varchar(128),activity varchar(256),notificationActionType varchar(512),content text,update_time varchar(16))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.uiuipad.os.push.tpush.common;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
|
||||
import com.uiuipad.os.push.tpush.po.XGNotification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NotificationService {
|
||||
private DBOpenHelper dbOpenHelper;
|
||||
private static NotificationService instance = null;
|
||||
|
||||
public NotificationService(Context context) {
|
||||
this.dbOpenHelper = new DBOpenHelper(context);
|
||||
}
|
||||
|
||||
public synchronized static NotificationService getInstance(Context ctx) {
|
||||
if (null == instance) {
|
||||
instance = new NotificationService(ctx);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void save(XGNotification notification) {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("msg_id", notification.getMsg_id());
|
||||
values.put("title", notification.getTitle());
|
||||
values.put("content", notification.getContent());
|
||||
values.put("activity", notification.getActivity());
|
||||
values.put("notificationActionType", notification.getNotificationActionType());
|
||||
values.put("update_time", notification.getUpdate_time());
|
||||
db.insert("notification", null, values);
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
db.delete("notification", "id=?", new String[] { id.toString() });
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
db.delete("notification", "", null);
|
||||
}
|
||||
|
||||
public void update(XGNotification notification) {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("msg_id", notification.getMsg_id());
|
||||
values.put("title", notification.getTitle());
|
||||
values.put("content", notification.getContent());
|
||||
values.put("activity", notification.getActivity());
|
||||
values.put("notificationActionType", notification.getNotificationActionType());
|
||||
values.put("update_time", notification.getUpdate_time());
|
||||
db.update("notification", values, "id=?", new String[] { notification
|
||||
.getId().toString() });
|
||||
}
|
||||
|
||||
public XGNotification find(Integer id) {
|
||||
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = db
|
||||
.query("notification",
|
||||
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
|
||||
"id=?", new String[] { id.toString() }, null, null,
|
||||
null, "1");
|
||||
try {
|
||||
if (cursor.moveToFirst()) {
|
||||
return new XGNotification(cursor.getInt(cursor
|
||||
.getColumnIndex("id")), cursor.getLong(cursor
|
||||
.getColumnIndex("msg_id")), cursor.getString(cursor
|
||||
.getColumnIndex("title")), cursor.getString(cursor
|
||||
.getColumnIndex("content")), cursor.getString(cursor
|
||||
.getColumnIndex("activity")), cursor.getInt(cursor
|
||||
.getColumnIndex("notificationActionType")), cursor.getString(cursor
|
||||
.getColumnIndex("update_time")));
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public List<XGNotification> getScrollData(int currentPage, int lineSize,
|
||||
String msg_id) {
|
||||
String firstResult = String.valueOf((currentPage - 1) * lineSize);
|
||||
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
if (msg_id == null || "".equals(msg_id)) {
|
||||
cursor = db
|
||||
.query("notification",
|
||||
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
|
||||
null, null, null, null, "update_time DESC",
|
||||
firstResult + "," + lineSize);
|
||||
} else {
|
||||
cursor = db
|
||||
.query("notification",
|
||||
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
|
||||
"msg_id like ?", new String[] { msg_id + "%" },
|
||||
null, null, "update_time DESC", firstResult
|
||||
+ "," + lineSize);
|
||||
}
|
||||
List<XGNotification> notifications = new ArrayList<XGNotification>();
|
||||
while (cursor.moveToNext()) {
|
||||
notifications.add(new XGNotification(cursor.getInt(cursor
|
||||
.getColumnIndex("id")), cursor.getLong(cursor
|
||||
.getColumnIndex("msg_id")), cursor.getString(cursor
|
||||
.getColumnIndex("title")), cursor.getString(cursor
|
||||
.getColumnIndex("content")), cursor.getString(cursor
|
||||
.getColumnIndex("activity")), cursor.getInt(cursor
|
||||
.getColumnIndex("notificationActionType")), cursor.getString(cursor
|
||||
.getColumnIndex("update_time"))));
|
||||
}
|
||||
return notifications;
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = db.rawQuery("select count(*) from notification", null);
|
||||
try {
|
||||
cursor.moveToFirst();
|
||||
return cursor.getInt(0);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.uiuipad.os.push.tpush.po;
|
||||
|
||||
public class XGNotification {
|
||||
private Integer id;
|
||||
private Long msg_id;
|
||||
private String title;
|
||||
private String content;
|
||||
private String activity;
|
||||
private int notificationActionType;
|
||||
private String update_time;
|
||||
|
||||
public XGNotification() {
|
||||
|
||||
}
|
||||
|
||||
public XGNotification(Integer id, Long msg_id, String title,
|
||||
String content, String activity, int notificationActionType, String update_time) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.msg_id = msg_id;
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.activity = activity;
|
||||
this.notificationActionType = notificationActionType;
|
||||
this.update_time = update_time;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getMsg_id() {
|
||||
return msg_id;
|
||||
}
|
||||
|
||||
public void setMsg_id(Long msg_id) {
|
||||
this.msg_id = msg_id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getUpdate_time() {
|
||||
return update_time;
|
||||
}
|
||||
|
||||
public void setUpdate_time(String update_time) {
|
||||
this.update_time = update_time;
|
||||
}
|
||||
|
||||
public String getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
||||
public void setActivity(String activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public int getNotificationActionType() {
|
||||
return notificationActionType;
|
||||
}
|
||||
|
||||
public void setNotificationActionType(int notificationActionType) {
|
||||
this.notificationActionType = notificationActionType;
|
||||
}
|
||||
}
|
||||
@@ -93,125 +93,6 @@ public class MainService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private final static long ONE_HOURS_TIME = 60 * 60 * 1000;
|
||||
private final static long TEN_MINUTES_TIME = 60 * 10 * 1000;
|
||||
|
||||
private void isScreenshot() {
|
||||
//1、检测应用使用情况,如果设备长时间运行一个应用,超过1小时,启动截屏一次。
|
||||
//2、检测设备在非正常时间使用时,使用第三方应用,在运行10分钟后,启动截屏功能一次
|
||||
//屏幕未点亮时不用截图
|
||||
// TODO: 2021/12/20 计算当前app打开时间
|
||||
String topPackageName = ForegroundAppUtil.getForegroundPackageName(MainService.this);
|
||||
Log.e(TAG, "isScreenshot: " + topPackageName);
|
||||
String pkg = TimeUtils.getInstance().getAppPackageName();
|
||||
if (TextUtils.isEmpty(pkg) || BuildConfig.APPLICATION_ID.equals(pkg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
//true为打开,false为关闭
|
||||
boolean screenOn = powerManager.isInteractive();
|
||||
Log.e(TAG, "isScreenshot: screenOn = " + screenOn);
|
||||
if (!screenOn) return;
|
||||
|
||||
long startTime = TimeUtils.getInstance().getStartTime();
|
||||
if (TimeUtils.getInstance().isNormalTime()) {//正常时间段
|
||||
if (System.currentTimeMillis() - startTime >= ONE_HOURS_TIME) {
|
||||
Log.e(TAG, "isScreenshot: " + "截图");
|
||||
doscreenshot(System.currentTimeMillis() / 1000);
|
||||
}
|
||||
} else {//非正常时间段
|
||||
if (System.currentTimeMillis() - startTime >= TEN_MINUTES_TIME) {
|
||||
Log.e(TAG, "isScreenshot: " + "截图");
|
||||
doscreenshot(System.currentTimeMillis() / 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doscreenshot(final long time) {
|
||||
Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
|
||||
String filepath = getExternalFilesDir("db").getAbsolutePath();
|
||||
int n = CmdUtil.execute("screencap -p " + filepath + File.separator + time + ".db").code;
|
||||
e.onNext(n);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer integer) {
|
||||
if (integer == 0) {
|
||||
uplaodImage(time);
|
||||
} else {
|
||||
Log.e("doss", "失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("doss", "Throwable=" + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void uplaodImage(long time) {
|
||||
String filepath = getExternalFilesDir("db").getAbsolutePath();
|
||||
// String filepath = mContext.getFileStreamPath("screenshot").getAbsolutePath();
|
||||
//放在app内部data下面
|
||||
File file = new File(filepath + File.separator + time + ".db");
|
||||
//不要直接使用常用图片格式
|
||||
if (!file.exists()) {
|
||||
Log.e("uplaodImage", "File does not exists");
|
||||
return;
|
||||
}
|
||||
//设置图片格式
|
||||
// RequestBody requestFile = RequestBody.create(MediaType.parse("image/jpg"), file);
|
||||
//File转RequestBody
|
||||
MediaType mediaType = MediaType.Companion.parse("image/png");
|
||||
RequestBody fileBody = RequestBody.Companion.create(file, mediaType);
|
||||
//设置一个file文件
|
||||
MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), fileBody);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("sn", Utils.getSerial(MainService.this));
|
||||
params.put("createtime", String.valueOf(time));
|
||||
NetInterfaceManager.getInstance().getScreenshotApi()
|
||||
.sendScreenshot(params, body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("uplaodImage", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("uplaodImage", "onNext: " + baseResponse.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("uplaodImage", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("uplaodImage", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.uiuipad.os.Workspace;
|
||||
import com.uiuipad.os.dragndrop.DragLayer;
|
||||
import com.uiuipad.os.userevent.nano.LauncherLogProto.Action;
|
||||
import com.uiuipad.os.userevent.nano.LauncherLogProto.ContainerType;
|
||||
import com.uiuipad.os.views.OptionsPopupView;
|
||||
|
||||
/**
|
||||
* Helper class to handle touch on empty space in workspace and show options popup on long press
|
||||
@@ -174,7 +175,7 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
|
||||
mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
|
||||
Action.Direction.NONE, ContainerType.WORKSPACE,
|
||||
mWorkspace.getCurrentPage());
|
||||
// OptionsPopupView.showDefaultOptions(mLauncher, mTouchDownPoint.x, mTouchDownPoint.y);
|
||||
OptionsPopupView.showDefaultOptions(mLauncher, mTouchDownPoint.x, mTouchDownPoint.y);
|
||||
} else {
|
||||
cancelLongPress();
|
||||
}
|
||||
|
||||