Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
449fed287e | ||
|
|
7458216cbc | ||
|
|
b3bf7c77f5 | ||
|
|
d2c7fdd5a8 | ||
|
|
4eb0d65e8a | ||
|
|
8e37bca0c3 | ||
|
|
151e488b6f | ||
|
|
5d349abe65 | ||
|
|
8fee8d692c | ||
|
|
da1efc3c32 | ||
|
|
0d2d9020bc | ||
|
|
feb7153f07 | ||
|
|
bf37aa8697 | ||
|
|
d83f154476 | ||
|
|
aa14ce6a1b | ||
|
|
d48b8126c1 | ||
|
|
5d19b2abb6 | ||
|
|
1a06826e43 | ||
|
|
eef0ca2568 | ||
|
|
d92cf00cba | ||
|
|
99b0de6007 | ||
|
|
f3564fb0f5 | ||
|
|
625a121cbb | ||
|
|
c508b65b58 | ||
|
|
19fb7d2451 | ||
|
|
7a268c2156 | ||
|
|
8acda9798b | ||
|
|
7425bdd59c | ||
|
|
99634fa71f | ||
|
|
de3cff39ae | ||
|
|
4f0685cfcd | ||
|
|
086677f4c4 | ||
|
|
b53c38b15f | ||
|
|
4501af324a | ||
|
|
65810fb045 | ||
|
|
dd2d56768a | ||
|
|
6bd36a3afb | ||
|
|
7903e3c21b | ||
|
|
9f6c360a9a | ||
|
|
8d8271901b | ||
|
|
e33b21142f | ||
|
|
f43e348a75 | ||
|
|
0700e40b84 | ||
|
|
046eeea74c | ||
|
|
0f081cd8d5 | ||
|
|
a51b5ff4df | ||
|
|
c67024dde5 | ||
|
|
6f409d2922 | ||
|
|
7f096b106c | ||
|
|
3db193a84e |
No files matched your search
@@ -36,6 +36,7 @@
|
||||
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
|
||||
android:protectionLevel="dangerous" />
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
|
||||
@@ -47,6 +48,15 @@
|
||||
<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" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
|
||||
|
||||
<!--
|
||||
Permissions required for read/write access to the workspace data. These permission name
|
||||
should not conflict with that defined in other apps, as such an app should embed its package
|
||||
@@ -69,12 +79,12 @@
|
||||
<uses-permission android:name="${packageName}.permission.WRITE_SETTINGS" />
|
||||
|
||||
<application
|
||||
android:name="com.aoleyun.os.base.MyApplication"
|
||||
android:backupAgent="com.aoleyun.os.LauncherBackupAgent"
|
||||
android:name=".base.BaseApplication"
|
||||
android:backupAgent=".LauncherBackupAgent"
|
||||
android:fullBackupContent="@xml/backupscheme"
|
||||
android:fullBackupOnly="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/ic_launcher_home"
|
||||
android:icon="@mipmap/ic_launcher_home"
|
||||
android:label="@string/derived_app_name"
|
||||
android:largeHeap="@bool/config_largeHeap"
|
||||
android:networkSecurityConfig="@xml/network"
|
||||
@@ -83,7 +93,7 @@
|
||||
|
||||
<!-- Intent received used to install shortcuts from other applications -->
|
||||
<receiver
|
||||
android:name="com.aoleyun.os.InstallShortcutReceiver"
|
||||
android:name=".InstallShortcutReceiver"
|
||||
android:enabled="@bool/enable_install_shortcut_api"
|
||||
android:permission="com.android.launcher.permission.INSTALL_SHORTCUT">
|
||||
<intent-filter>
|
||||
@@ -92,27 +102,41 @@
|
||||
</receiver>
|
||||
|
||||
<!-- Intent received when a session is committed -->
|
||||
<receiver android:name="com.aoleyun.os.SessionCommitReceiver">
|
||||
<receiver android:name=".SessionCommitReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.content.pm.action.SESSION_COMMITTED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Intent received used to initialize a restored widget -->
|
||||
<receiver android:name="com.aoleyun.os.AppWidgetsRestoredReceiver">
|
||||
<receiver android:name=".AppWidgetsRestoredReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_HOST_RESTORED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.NewAppReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.INSTALL_PACKAGES">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
<action android:name="android.intent.action.PACKAGE_CHANGED" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="com.aoleyun.os.uioverrides.dynamicui.WallpaperManagerCompatVL$ColorExtractionService"
|
||||
android:name=".uioverrides.dynamicui.WallpaperManagerCompatVL$ColorExtractionService"
|
||||
android:exported="false"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||
android:process=":wallpaper_chooser" />
|
||||
|
||||
<service
|
||||
android:name="com.aoleyun.os.notification.NotificationListener"
|
||||
android:name=".notification.NotificationListener"
|
||||
android:enabled="@bool/notification_dots_enabled"
|
||||
android:label="@string/notification_dots_service_title"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||
@@ -126,7 +150,7 @@
|
||||
android:value="true" />
|
||||
|
||||
<activity
|
||||
android:name="com.aoleyun.os.dragndrop.AddItemActivity"
|
||||
android:name=".dragndrop.AddItemActivity"
|
||||
android:autoRemoveFromRecents="true"
|
||||
android:excludeFromRecents="true"
|
||||
android:label="@string/action_add_to_workspace"
|
||||
@@ -151,7 +175,7 @@
|
||||
represent the package name.
|
||||
-->
|
||||
<provider
|
||||
android:name="com.aoleyun.os.LauncherProvider"
|
||||
android:name=".LauncherProvider"
|
||||
android:authorities="${packageName}.settings"
|
||||
android:exported="true"
|
||||
android:readPermission="${packageName}.permission.READ_SETTINGS"
|
||||
@@ -162,7 +186,7 @@
|
||||
TODO: Add proper permissions
|
||||
-->
|
||||
<provider
|
||||
android:name="com.aoleyun.os.graphics.GridOptionsProvider"
|
||||
android:name=".graphics.GridOptionsProvider"
|
||||
android:authorities="${packageName}.grid_control"
|
||||
android:enabled="false"
|
||||
android:exported="true" />
|
||||
@@ -171,7 +195,7 @@
|
||||
The settings activity. To extend point settings_fragment_name to appropriate fragment class
|
||||
-->
|
||||
<activity
|
||||
android:name="com.aoleyun.os.settings.SettingsActivity"
|
||||
android:name=".settings.SettingsActivity"
|
||||
android:autoRemoveFromRecents="true"
|
||||
android:label="@string/settings_button_text"
|
||||
android:theme="@android:style/Theme.DeviceDefault.Settings">
|
||||
@@ -182,7 +206,7 @@
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.aoleyun.os.Launcher"
|
||||
android:name=".Launcher"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
|
||||
android:enabled="true"
|
||||
@@ -205,165 +229,12 @@
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="com.aoleyun.os.testing.TestInformationProvider"
|
||||
android:name=".testing.TestInformationProvider"
|
||||
android:authorities="${packageName}.TestInfo"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:readPermission="android.permission.WRITE_SECURE_SETTINGS"
|
||||
android:writePermission="android.permission.WRITE_SECURE_SETTINGS" />
|
||||
|
||||
|
||||
<!-- Rich push 核心功能 since 2.0.6-->
|
||||
<activity
|
||||
android:name="cn.jpush.android.ui.PopWinActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/MyDialogStyle"
|
||||
tools:replace="android:exported"></activity>
|
||||
|
||||
<!-- Required SDK核心功能-->
|
||||
<activity
|
||||
android:name="cn.jpush.android.ui.PushActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:theme="@android:style/Theme.NoTitleBar"
|
||||
tools:replace="android:exported">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.ui.PushActivity" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Required SDK 核心功能-->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
<service
|
||||
android:name="cn.jpush.android.service.PushService"
|
||||
android:exported="false"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.REGISTER" />
|
||||
<action android:name="cn.jpush.android.intent.REPORT" />
|
||||
<action android:name="cn.jpush.android.intent.PushService" />
|
||||
<action android:name="cn.jpush.android.intent.PUSH_TIME" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- since 3.0.9 Required SDK 核心功能-->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DataProvider"
|
||||
android:authorities="${applicationId}.DataProvider"
|
||||
android:exported="false"
|
||||
android:process=":pushcore"
|
||||
tools:replace="android:authorities" />
|
||||
|
||||
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
|
||||
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
|
||||
<service
|
||||
android:name="cn.jpush.android.service.DaemonService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.DaemonService" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
|
||||
</service>
|
||||
|
||||
<!-- since 3.1.0 Required SDK 核心功能-->
|
||||
<provider
|
||||
android:name="cn.jpush.android.service.DownloadProvider"
|
||||
android:authorities="${applicationId}.DownloadProvider"
|
||||
android:exported="true"
|
||||
tools:replace="android:authorities" />
|
||||
|
||||
<!-- Required SDK核心功能-->
|
||||
<receiver
|
||||
android:name="cn.jpush.android.service.PushReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
tools:replace="android:exported">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <!--Required 显示通知栏 -->
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.USER_PRESENT" />
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
<!-- Optional -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Required SDK核心功能-->
|
||||
<receiver
|
||||
android:name="cn.jpush.android.service.AlarmReceiver"
|
||||
android:exported="false" />
|
||||
|
||||
|
||||
<!-- User defined. For test only 用户自定义的广播接收器-->
|
||||
<receiver
|
||||
android:name="com.aoleyun.os.jpush.MyReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.REGISTRATION" /> <!--Required 用户注册SDK的intent-->
|
||||
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!--Required 用户接收SDK消息的intent-->
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!--Required 用户接收SDK通知栏信息的intent-->
|
||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!--Required 用户打开自定义通知栏的intent-->
|
||||
<action android:name="cn.jpush.android.intent.CONNECTION" /><!-- 接收网络变化 连接/断开 since 1.6.3 -->
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
||||
<!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调-->
|
||||
<!--since 3.3.0 接收JPush相关事件-->
|
||||
<receiver android:name="com.aoleyun.os.jpush.MyJPushMessageReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="com.aoleyun.os.receiver.InstallResultReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<!--since 3.3.0 Required SDK核心功能-->
|
||||
<activity
|
||||
android:name="cn.jpush.android.service.JNotifyActivity"
|
||||
android:exported="true"
|
||||
android:taskAffinity="jpush.custom"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- since 3.3.0 Required SDK 核心功能-->
|
||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||
<!--User defined. For test only 继承自cn.jpush.android.service.JCommonService-->
|
||||
<service
|
||||
android:name="com.aoleyun.os.jpush.PushService"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jiguang.user.service.action" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- Required . Enable it you can get statistics data with channel -->
|
||||
<meta-data
|
||||
android:name="JPUSH_CHANNEL"
|
||||
android:value="${JPUSH_CHANNEL}" />
|
||||
<meta-data
|
||||
android:name="JPUSH_APPKEY"
|
||||
android:value="${JPUSH_APPKEY}" /> <!-- </>值来自开发者平台取得的AppKey-->
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -7,13 +7,13 @@
|
||||
android:targetSdkVersion="29" />
|
||||
|
||||
<application
|
||||
android:name="com.aoleyun.os.base.MyApplication"
|
||||
android:name="com.aoleyun.os.base.BaseApplication"
|
||||
android:backupAgent="com.aoleyun.os.LauncherBackupAgent"
|
||||
android:extractNativeLibs="false"
|
||||
android:fullBackupContent="@xml/backupscheme"
|
||||
android:fullBackupOnly="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/ic_launcher_home"
|
||||
android:icon="@mipmap/ic_launcher_home"
|
||||
android:label="@string/derived_app_name"
|
||||
android:largeHeap="@bool/config_largeHeap"
|
||||
android:restoreAnyVersion="true"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.google.com' }
|
||||
maven { url 'https://developer.huawei.com/repo/' }
|
||||
@@ -11,6 +11,7 @@ buildscript {
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath GRADLE_CLASS_PATH
|
||||
classpath PROTOBUF_CLASS_PATH
|
||||
@@ -51,11 +52,11 @@ allprojects {
|
||||
}
|
||||
|
||||
def appName() {
|
||||
return "奥乐云桌面"
|
||||
return "AoleyunLauncher3"
|
||||
}
|
||||
|
||||
def releaseTime() {
|
||||
return new Date().format("yyyyMMdd", TimeZone.getDefault())
|
||||
return new Date().format("yyyyMMdd_HHmmss", TimeZone.getDefault())
|
||||
}
|
||||
|
||||
final String ANDROID_TOP = "${rootDir}"
|
||||
@@ -73,6 +74,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
|
||||
versionCode 216
|
||||
versionName "1.6.1016"
|
||||
|
||||
@@ -87,12 +89,6 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME: "com.aoleyun.os",
|
||||
JPUSH_APPKEY : "0c7ba5a1622dba78d5bd00cc", //JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
|
||||
]
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
@@ -111,7 +107,7 @@ android {
|
||||
//签名
|
||||
signingConfigs {
|
||||
zhanRui {
|
||||
storeFile file("src/doc/zhanxun.keystore")
|
||||
storeFile file("keystore/zhanxun.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanxun"
|
||||
keyPassword "123456"
|
||||
@@ -119,61 +115,535 @@ android {
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
zhanRuiUserdebug {
|
||||
storeFile file("keystore/zhanxunUserdebug.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanxunUserdebug"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
zhanRui12 {
|
||||
storeFile file("keystore/zhanrui12.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanrui12"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
mtk {
|
||||
storeFile file("src/doc/xueshibaoos.jks")
|
||||
storeFile file("keystore/xueshibaoos.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "xueshibaoos"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
TeclastP20S {
|
||||
storeFile file("keystore/MTKP20S.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "MTKP20S"
|
||||
keyPassword "123456"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
zhanruiG10Z {
|
||||
storeFile file("keystore/zhanruiG10Z.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "zhanruiG10Z"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
iPlay50miniPro {
|
||||
storeFile file("keystore/iPlay50miniPro.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "iplay50minipro"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G10P {
|
||||
storeFile file("keystore/G10PMTK11.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "G10PMTK11"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G11Userdebug {
|
||||
storeFile file("keystore/G11Userdebug.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "G11Userdebug"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
teclast8183 {
|
||||
storeFile file("keystore/TeclastMTK12.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "TeclastMTK12"
|
||||
keyPassword "123456"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
Huaruian8768 {
|
||||
storeFile file("keystore/Huaruian8768.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "Huaruian8768"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
T40Air {
|
||||
storeFile file("keystore/T40Air.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "T40Air"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
P50 {
|
||||
storeFile file("keystore/P50TD.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "P50TD"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
seewo {
|
||||
storeFile file("keystore/aiud.keystore")
|
||||
storePassword "s4HdJuphaiHhU7WY"
|
||||
keyAlias "androidreleasekey"
|
||||
keyPassword "JwUw2oV16rUjWLBC"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
U1302 {
|
||||
storeFile file("keystore/U1302.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "u1302"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G128T {
|
||||
storeFile file("keystore/HuaruianG128T.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "g128t"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G122 {
|
||||
storeFile file("keystore/6789U.p12")
|
||||
storePassword "123456"
|
||||
keyAlias "6789u"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
DX11 {
|
||||
storeFile file("keystore/DX11.p12")
|
||||
storePassword "123456"
|
||||
keyAlias "dx11"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
MT6789 {
|
||||
storeFile file("keystore/MT6789.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "mt6789"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
SM8150 {
|
||||
storeFile file("src/doc/sm8150.jks")
|
||||
storeFile file("keystore/sm8150.jks")
|
||||
storePassword "logan-123456789"
|
||||
keyAlias "platformkey"
|
||||
keyPassword "logan-123456789"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G122J {
|
||||
storeFile file("keystore/G122J.p12")
|
||||
storePassword "123456"
|
||||
keyAlias "g122j"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
G122JDebug.initWith(debug)
|
||||
G122JDebug {
|
||||
buildConfigField "String", "platform", '"G122J"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G122J
|
||||
}
|
||||
|
||||
G122JRelease.initWith(release)
|
||||
G122JRelease {
|
||||
buildConfigField "String", "platform", '"G122J"'
|
||||
signingConfig signingConfigs.G122J
|
||||
}
|
||||
|
||||
G12NLDebug.initWith(debug)
|
||||
G12NLDebug {
|
||||
buildConfigField "String", "platform", '"G12NL"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.MT6789
|
||||
}
|
||||
|
||||
G12NLRelease.initWith(release)
|
||||
G12NLRelease {
|
||||
buildConfigField "String", "platform", '"G12NL"'
|
||||
signingConfig signingConfigs.MT6789
|
||||
}
|
||||
|
||||
DX11Debug.initWith(debug)
|
||||
DX11Debug {
|
||||
buildConfigField "String", "platform", '"DX11"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.DX11
|
||||
}
|
||||
|
||||
DX11Release.initWith(release)
|
||||
DX11Release {
|
||||
buildConfigField "String", "platform", '"DX11"'
|
||||
signingConfig signingConfigs.DX11
|
||||
}
|
||||
|
||||
G122Debug.initWith(debug)
|
||||
G122Debug {
|
||||
buildConfigField "String", "platform", '"MT6765"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G122
|
||||
}
|
||||
|
||||
G122Release.initWith(release)
|
||||
G122Release {
|
||||
buildConfigField "String", "platform", '"MT6765"'
|
||||
signingConfig signingConfigs.G122
|
||||
}
|
||||
|
||||
QualcommDebug.initWith(debug)
|
||||
QualcommDebug {
|
||||
buildConfigField "String", "platform", '"QualcommA"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.SM8150
|
||||
}
|
||||
|
||||
QualcommRelease.initWith(release)
|
||||
QualcommRelease {
|
||||
buildConfigField "String", "platform", '"QualcommA"'
|
||||
signingConfig signingConfigs.SM8150
|
||||
}
|
||||
|
||||
G128TDebug.initWith(debug)
|
||||
G128TDebug {
|
||||
buildConfigField "String", "platform", '"G128T"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G128T
|
||||
}
|
||||
|
||||
G128TRelease.initWith(release)
|
||||
G128TRelease {
|
||||
buildConfigField "String", "platform", '"G128T"'
|
||||
signingConfig signingConfigs.G128T
|
||||
}
|
||||
|
||||
QZ15Debug.initWith(debug)
|
||||
QZ15Debug {
|
||||
buildConfigField "String", "platform", '"QZA15"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.U1302
|
||||
}
|
||||
|
||||
QZ15Release.initWith(release)
|
||||
QZ15Release {
|
||||
buildConfigField "String", "platform", '"QZA15"'
|
||||
signingConfig signingConfigs.U1302
|
||||
}
|
||||
|
||||
seewoDebug.initWith(debug)
|
||||
seewoDebug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.seewo
|
||||
buildConfigField "String", "platform", '"seewo"'
|
||||
}
|
||||
|
||||
seewoRelease.initWith(release)
|
||||
seewoRelease {
|
||||
signingConfig signingConfigs.seewo
|
||||
buildConfigField "String", "platform", '"seewo"'
|
||||
}
|
||||
|
||||
P50Debug.initWith(debug)
|
||||
P50Debug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.P50
|
||||
buildConfigField "String", "platform", '"P50TD"'
|
||||
}
|
||||
|
||||
P50Release.initWith(release)
|
||||
P50Release {
|
||||
signingConfig signingConfigs.P50
|
||||
buildConfigField "String", "platform", '"P50TD"'
|
||||
}
|
||||
|
||||
T40AirDebug.initWith(debug)
|
||||
T40AirDebug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.T40Air
|
||||
buildConfigField "String", "platform", '"HL500"'
|
||||
}
|
||||
|
||||
T40AirRelease.initWith(release)
|
||||
T40AirRelease {
|
||||
signingConfig signingConfigs.T40Air
|
||||
buildConfigField "String", "platform", '"HL500"'
|
||||
}
|
||||
|
||||
// AiUduDebug.initWith(debug)
|
||||
// AiUduDebug {
|
||||
// versionNameSuffix "_debug"
|
||||
// debuggable true
|
||||
// signingConfig signingConfigs.G10P
|
||||
// buildConfigField "String", "platform", '"AUDG104"'
|
||||
// }
|
||||
//
|
||||
// AiUduRelease.initWith(release)
|
||||
// AiUduRelease {
|
||||
// signingConfig signingConfigs.G10P
|
||||
// buildConfigField "String", "platform", '"AUDG104"'
|
||||
// }
|
||||
|
||||
Huaruian8768Debug.initWith(debug)
|
||||
Huaruian8768Debug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.Huaruian8768
|
||||
buildConfigField "String", "platform", '"MT8768"'
|
||||
}
|
||||
|
||||
Huaruian8768Release.initWith(release)
|
||||
Huaruian8768Release {
|
||||
signingConfig signingConfigs.Huaruian8768
|
||||
buildConfigField "String", "platform", '"MT8768"'
|
||||
}
|
||||
|
||||
G11Debug.initWith(debug)
|
||||
G11Debug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G11Userdebug
|
||||
buildConfigField "String", "platform", '"MTKG11"'
|
||||
}
|
||||
|
||||
G11Release.initWith(release)
|
||||
G11Release {
|
||||
signingConfig signingConfigs.G11Userdebug
|
||||
buildConfigField "String", "platform", '"MTKG11"'
|
||||
}
|
||||
|
||||
YXPD1Debug.initWith(debug)
|
||||
YXPD1Debug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G10P
|
||||
buildConfigField "String", "platform", '"YXPD1"'
|
||||
}
|
||||
|
||||
YXPD1Release.initWith(release)
|
||||
YXPD1Release {
|
||||
signingConfig signingConfigs.G10P
|
||||
buildConfigField "String", "platform", '"YXPD1"'
|
||||
}
|
||||
|
||||
c2Debug.initWith(debug)
|
||||
c2Debug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.teclast8183
|
||||
buildConfigField "String", "platform", '"MTK8183"'
|
||||
}
|
||||
|
||||
c2Release.initWith(release)
|
||||
c2Release {
|
||||
signingConfig signingConfigs.teclast8183
|
||||
buildConfigField "String", "platform", '"MTK8183"'
|
||||
}
|
||||
|
||||
G10PDebug.initWith(debug)
|
||||
G10PDebug {
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G10P
|
||||
buildConfigField "String", "platform", '"G10P"'
|
||||
}
|
||||
|
||||
G10PRelease.initWith(release)
|
||||
G10PRelease {
|
||||
signingConfig signingConfigs.G10P
|
||||
buildConfigField "String", "platform", '"G10P"'
|
||||
}
|
||||
|
||||
G104Debug.initWith(debug)
|
||||
G104Debug {
|
||||
buildConfigField "String", "platform", '"MTK11"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.G10P
|
||||
}
|
||||
|
||||
G104Release.initWith(release)
|
||||
G104Release {
|
||||
buildConfigField "String", "platform", '"MTK11"'
|
||||
signingConfig signingConfigs.G10P
|
||||
}
|
||||
|
||||
iPlay50miniProDebug.initWith(debug)
|
||||
iPlay50miniProDebug {
|
||||
buildConfigField "String", "platform", '"miniG99"'
|
||||
versionNameSuffix "_debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.iPlay50miniPro
|
||||
}
|
||||
|
||||
iPlay50miniProRelease.initWith(release)
|
||||
iPlay50miniProRelease {
|
||||
buildConfigField "String", "platform", '"miniG99"'
|
||||
signingConfig signingConfigs.iPlay50miniPro
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
zhanRuiDebug.initWith(debug)
|
||||
zhanRuiDebug {
|
||||
versionNameSuffix "-debug"
|
||||
//userdebug rom使用这个版本
|
||||
zhanRuiUserdebug.initWith(zhanRuiDebug)
|
||||
zhanRuiUserdebug {
|
||||
versionNameSuffix "_debug"
|
||||
buildConfigField "String", "platform", '"ZhanRui"'
|
||||
debuggable true
|
||||
signingConfig signingConfigs.zhanRui
|
||||
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
|
||||
versionNameSuffix "_debug"
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.SM8150
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.mtk
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${productFlavors[0].name}.apk"
|
||||
output.outputFileName = fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.SM8150
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.all { output -> // 改为 all
|
||||
def buildType = variant.buildType.name
|
||||
if (buildType.contains("debug")) {
|
||||
outputFileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk"
|
||||
} else {
|
||||
outputFileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.mtk
|
||||
//将release版本的包名重命名,加上版本及日期
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = ""
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${productFlavors[0].name}_${buildType.name}.apk"
|
||||
output.outputFileName = fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,11 +659,12 @@ android {
|
||||
testApplicationId 'com.aoleyun.os.tests'
|
||||
}
|
||||
|
||||
l3go {
|
||||
dimension "app"
|
||||
applicationId 'com.aoleyun.os'
|
||||
testApplicationId 'com.aoleyun.os.tests'
|
||||
}
|
||||
/*hide l3go*/
|
||||
// l3go {
|
||||
// dimension "app"
|
||||
// applicationId 'com.aoleyun.os'
|
||||
// testApplicationId 'com.aoleyun.os.tests'
|
||||
// }
|
||||
|
||||
/*withQuickstep {
|
||||
dimension "recents"
|
||||
@@ -254,11 +725,12 @@ android {
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
}
|
||||
|
||||
l3go {
|
||||
res.srcDirs = ['go/res']
|
||||
java.srcDirs = ['go/src']
|
||||
manifest.srcFile "go/AndroidManifest.xml"
|
||||
}
|
||||
/*hide l3go*/
|
||||
// l3go {
|
||||
// res.srcDirs = ['go/res']
|
||||
// java.srcDirs = ['go/src']
|
||||
// manifest.srcFile "go/AndroidManifest.xml"
|
||||
// }
|
||||
|
||||
withoutQuickstep {
|
||||
java.srcDirs = ['src_ui_overrides']
|
||||
@@ -281,13 +753,22 @@ android {
|
||||
repositories {
|
||||
maven { url "../../../prebuilts/fullsdk-darwin/extras/android/m2repository" }
|
||||
maven { url "../../../prebuilts/fullsdk-linux/extras/android/m2repository" }
|
||||
|
||||
// google()
|
||||
mavenCentral()
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.google.com' }
|
||||
maven { url 'https://developer.huawei.com/repo/' }
|
||||
maven { url 'https://developer.hihonor.com/repo' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly files('libs/framework.jar')
|
||||
implementation files('libs/vendor.mediatek.hardware.nvram-V1.0-java.jar')
|
||||
|
||||
implementation "androidx.dynamicanimation:dynamicanimation:${ANDROID_X_VERSION}"
|
||||
implementation "androidx.recyclerview:recyclerview:${ANDROID_X_VERSION}"
|
||||
@@ -314,25 +795,33 @@ dependencies {
|
||||
androidTestImplementation 'com.android.support.test:rules:1.0.0'
|
||||
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
||||
androidTestImplementation "androidx.annotation:annotation:${ANDROID_X_VERSION}"
|
||||
|
||||
//OkHttp
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.2'
|
||||
//RxJava和Retrofit
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
|
||||
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
|
||||
//gson
|
||||
implementation 'com.google.code.gson:gson:2.8.7'
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
//磁盘缓存
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
//mmkv
|
||||
implementation 'com.tencent:mmkv-static:1.2.10'
|
||||
//极光推送
|
||||
implementation 'cn.jiguang.sdk:jpush:3.8.5' // 此处以JPush 3.8.6 版本为例。
|
||||
implementation 'cn.jiguang.sdk:jcore:2.7.8' // 此处以JCore 2.6.0 版本为例。
|
||||
implementation 'com.tencent:mmkv-static:2.4.0'
|
||||
//bugly
|
||||
implementation 'com.tencent.bugly:crashreport:4.1.9.2'
|
||||
// //腾讯移动推送 TPNS
|
||||
// implementation 'com.tencent.tpns:tpns:1.3.2.0-release'
|
||||
// //阿里云推送
|
||||
// implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
|
||||
//下载
|
||||
implementation 'me.laoyuyu.aria:core:3.8.16'
|
||||
annotationProcessor 'me.laoyuyu.aria:compiler:3.8.16'
|
||||
//工具类
|
||||
implementation 'com.blankj:utilcodex:1.30.6'
|
||||
implementation 'com.blankj:utilcodex:1.31.1'
|
||||
// 吐司框架:https://github.com/getActivity/Toaster
|
||||
implementation 'com.github.getActivity:Toaster:12.6'
|
||||
}
|
||||
|
||||
// 在 dependencies 之后添加
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
android:fullBackupOnly="true"
|
||||
android:fullBackupContent="@xml/backupscheme"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/ic_launcher_home"
|
||||
android:icon="@mipmap/ic_launcher_home"
|
||||
android:label="@string/derived_app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:largeHeap="@bool/config_largeHeap"
|
||||
|
||||
@@ -15,22 +15,56 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
zhanRuiRelease.initWith(release)
|
||||
zhanRuiRelease {
|
||||
minifyEnabled false
|
||||
}
|
||||
|
||||
zhanRuiDebug.initWith(debug)
|
||||
zhanRuiDebug {
|
||||
minifyEnabled false
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
}
|
||||
|
||||
release {
|
||||
minifyEnabled false
|
||||
}
|
||||
G122JDebug {}
|
||||
G122JRelease {}
|
||||
MX11Debug {}
|
||||
MX11Release {}
|
||||
G12NLDebug {}
|
||||
G12NLRelease {}
|
||||
DX11Debug {}
|
||||
DX11Release {}
|
||||
G122Debug {}
|
||||
G122Release {}
|
||||
QualcommDebug {}
|
||||
QualcommRelease {}
|
||||
G128TDebug {}
|
||||
G128TRelease {}
|
||||
QZ15Debug {}
|
||||
QZ15Release {}
|
||||
seewoDebug {}
|
||||
seewoRelease {}
|
||||
P50Debug {}
|
||||
P50Release {}
|
||||
T40AirDebug {}
|
||||
T40AirRelease {}
|
||||
AiUduDebug {}
|
||||
AiUduRelease {}
|
||||
Huaruian8768Debug {}
|
||||
Huaruian8768Release {}
|
||||
G11Debug {}
|
||||
G11Release {}
|
||||
YXPD1Debug {}
|
||||
YXPD1Release {}
|
||||
c2Debug {}
|
||||
c2Release {}
|
||||
G104Debug {}
|
||||
G104Release {}
|
||||
iPlay50miniProDebug {}
|
||||
iPlay50miniProRelease {}
|
||||
G10PDebug {}
|
||||
G10PRelease {}
|
||||
zhanRuiDebug {}
|
||||
zhanRuiRelease {}
|
||||
zhanRui12Debug {}
|
||||
zhanRui12Release {}
|
||||
alldocubeDebug {}
|
||||
alldocubeDebugReleas {}
|
||||
TeclastP20SDebug {}
|
||||
TeclastP20SRelease {}
|
||||
zhanruiG10ZDebug {}
|
||||
zhanruiG10ZRelease {}
|
||||
debug {}
|
||||
release {}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -329,7 +329,7 @@ public class BaseIconFactory implements AutoCloseable {
|
||||
/**
|
||||
* An extension of {@link BitmapDrawable} which returns the bitmap pixel size as intrinsic size.
|
||||
* This allows the badging to be done based on the action bitmap size rather than
|
||||
* the scaled bitmap size.
|
||||
* the scaled bitmap size.c
|
||||
*/
|
||||
private static class FixedSizeBitmapDrawable extends BitmapDrawable {
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
android:fullBackupOnly="true"
|
||||
android:fullBackupContent="@xml/backupscheme"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/ic_launcher_home"
|
||||
android:icon="@mipmap/ic_launcher_home"
|
||||
android:label="@string/derived_app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:largeHeap="@bool/config_largeHeap"
|
||||
|
||||
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 833 KiB |
@@ -2,8 +2,8 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="0.8dp"
|
||||
android:color="#ffffff" />
|
||||
android:width="1dp"
|
||||
android:color="#000000" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
@@ -53,6 +53,17 @@
|
||||
tools:text="请输入密码" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/icon_close" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 25 KiB |
@@ -20,7 +20,7 @@
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="app_name" msgid="649227358658669779">"Launcher3"</string>
|
||||
<string name="folder_name" msgid="7371454440695724752"></string>
|
||||
<string name="folder_name" msgid="7371454440695724752">文件夹</string>
|
||||
<string name="work_folder_name" msgid="3753320833950115786">"Work"</string>
|
||||
<string name="activity_not_found" msgid="8071924732094499514">"未安装该应用。"</string>
|
||||
<string name="activity_not_available" msgid="7456344436509528827">"应用不可用"</string>
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
<!-- Extra bottom padding for non-tall devices. -->
|
||||
<dimen name="dynamic_grid_hotseat_bottom_non_tall_padding">0dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_extra_vertical_size">34dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_extra_vertical_size_aiudu">56dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_side_padding">0dp</dimen>
|
||||
|
||||
<!-- Hotseat/all-apps scrim -->
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<string name="app_uiui">桌面</string>
|
||||
|
||||
<!-- Default folder name -->
|
||||
<string name="folder_name"></string>
|
||||
<string name="folder_name">文件夹</string>
|
||||
<!-- Work folder name -->
|
||||
<string name="work_folder_name">Work</string>
|
||||
<!-- Displayed when user selects a shortcut for an app that was uninstalled [CHAR_LIMIT=none]-->
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<widget
|
||||
android:label="My custom widget"
|
||||
android:initialLayout="@layout/sample_widget_layout"
|
||||
android:icon="@drawable/ic_launcher_home"
|
||||
android:icon="@mipmap/ic_launcher_home"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
launcher:numRows="2"
|
||||
launcher:numColumns="3"
|
||||
|
||||
@@ -62,10 +62,18 @@
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MUSIC;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <favorite-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:className="com.aoleyun.browser.activity.main.MainActivity"-->
|
||||
<!-- launcher:packageName="com.aoleyun.browser"-->
|
||||
<!-- launcher:screen="2"-->
|
||||
<!-- launcher:x="2"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:className="com.uiui.browser.activity.MainActivity"
|
||||
launcher:packageName="com.uiui.browser"
|
||||
launcher:className="com.aoleyun.info.activity.main.MainActivity"
|
||||
launcher:packageName="com.aoleyun.info"
|
||||
launcher:screen="2"
|
||||
launcher:x="2"
|
||||
launcher:y="0" />
|
||||
@@ -78,22 +86,38 @@
|
||||
launcher:x="3"
|
||||
launcher:y="0" />
|
||||
|
||||
<resolve
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="4"-->
|
||||
<!-- launcher:x="4"-->
|
||||
<!-- launcher:y="0">-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.media.action.STILL_IMAGE_CAMERA;end" />-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.CAMERA_BUTTON;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="5"-->
|
||||
<!-- launcher:x="5"-->
|
||||
<!-- launcher:y="0">-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;component=com.android.deskclock/.DeskClock;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:className="com.aoleyun.sn.activity.update.UpdateActivity"
|
||||
launcher:packageName="com.aoleyun.sn"
|
||||
launcher:screen="4"
|
||||
launcher:x="4"
|
||||
launcher:y="0">
|
||||
<favorite launcher:uri="#Intent;action=android.media.action.STILL_IMAGE_CAMERA;end" />
|
||||
<favorite launcher:uri="#Intent;action=android.intent.action.CAMERA_BUTTON;end" />
|
||||
</resolve>
|
||||
launcher:y="0" />
|
||||
|
||||
<resolve
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:className="com.aoleyun.sn.activity.EyeProtectionActivity"
|
||||
launcher:packageName="com.aoleyun.sn"
|
||||
launcher:screen="5"
|
||||
launcher:x="5"
|
||||
launcher:y="0">
|
||||
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;component=com.android.deskclock/.DeskClock;end" />
|
||||
</resolve>
|
||||
launcher:y="0" />
|
||||
|
||||
<!-- Bottom row -->
|
||||
<!-- <resolve-->
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2009 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.uiuios">
|
||||
|
||||
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
|
||||
<!-- Dialer, Messaging, [Maps/Music], Browser, Camera -->
|
||||
<!-- <favorite-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:className="com.aoleyun.sn.activity.SplashActivity"-->
|
||||
<!-- launcher:packageName="com.aoleyun.sn"-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="0"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:className="com.aoleyun.appstore.activity.SplashActivity"
|
||||
launcher:packageName="com.aoleyun.appstore"
|
||||
launcher:screen="1"
|
||||
launcher:x="1"
|
||||
launcher:y="0" />
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="0"-->
|
||||
<!-- launcher:y="0" >-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.DIAL;end" />-->
|
||||
<!-- <favorite launcher:uri="tel:123" />-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.CALL_BUTTON;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="1"-->
|
||||
<!-- launcher:x="1"-->
|
||||
<!-- launcher:y="0" >-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MESSAGING;end" />-->
|
||||
<!-- <favorite launcher:uri="sms:" />-->
|
||||
<!-- <favorite launcher:uri="smsto:" />-->
|
||||
<!-- <favorite launcher:uri="mms:" />-->
|
||||
<!-- <favorite launcher:uri="mmsto:" />-->
|
||||
<!-- </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_MAPS;end" />-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MUSIC;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <favorite-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:className="com.aoleyun.browser.activity.main.MainActivity"-->
|
||||
<!-- launcher:packageName="com.aoleyun.browser"-->
|
||||
<!-- launcher:screen="2"-->
|
||||
<!-- launcher:x="2"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:className="com.aoleyun.info.activity.main.MainActivity"
|
||||
launcher:packageName="com.aoleyun.info"
|
||||
launcher:screen="2"
|
||||
launcher:x="2"
|
||||
launcher:y="0" />
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:className="com.android.settings.Settings"
|
||||
launcher:packageName="com.android.settings"
|
||||
launcher:screen="3"
|
||||
launcher:x="3"
|
||||
launcher:y="0" />
|
||||
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="4"-->
|
||||
<!-- launcher:x="4"-->
|
||||
<!-- launcher:y="0">-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.media.action.STILL_IMAGE_CAMERA;end" />-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.CAMERA_BUTTON;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:screen="5"-->
|
||||
<!-- launcher:x="5"-->
|
||||
<!-- launcher:y="0">-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;component=com.android.deskclock/.DeskClock;end" />-->
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <favorite-->
|
||||
<!-- launcher:container="-101"-->
|
||||
<!-- launcher:className="com.aoleyun.sn.activity.update.UpdateActivity"-->
|
||||
<!-- launcher:packageName="com.aoleyun.sn"-->
|
||||
<!-- launcher:screen="4"-->
|
||||
<!-- launcher:x="4"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
|
||||
<favorite
|
||||
launcher:container="-101"
|
||||
launcher:className="com.aoleyun.sn.activity.EyeProtectionActivity"
|
||||
launcher:packageName="com.aoleyun.sn"
|
||||
launcher:screen="4"
|
||||
launcher:x="4"
|
||||
launcher:y="0" />
|
||||
|
||||
<!-- Bottom row -->
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="0"-->
|
||||
<!-- launcher:y="-1" >-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_EMAIL;end" />-->
|
||||
<!-- <favorite launcher:uri="mailto:" />-->
|
||||
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="1"-->
|
||||
<!-- launcher:y="-1" >-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_GALLERY;end" />-->
|
||||
<!-- <favorite launcher:uri="#Intent;type=images/*;end" />-->
|
||||
|
||||
<!-- </resolve>-->
|
||||
|
||||
<!-- <resolve-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="4"-->
|
||||
<!-- launcher:y="-1" >-->
|
||||
<!-- <favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MARKET;end" />-->
|
||||
<!-- <favorite launcher:uri="market://details?id=com.android.launcher" />-->
|
||||
<!-- </resolve>-->
|
||||
<!-- <favorite-->
|
||||
<!-- launcher:className="com.info.sn.activity.MainActivity"-->
|
||||
<!-- launcher:packageName="com.info.sn"-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="0"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
<!-- <favorite-->
|
||||
<!-- launcher:className="com.jiaoguanyi.sysc.activity.MainActivity"-->
|
||||
<!-- launcher:packageName="com.jiaoguanyi.sysc"-->
|
||||
<!-- launcher:screen="0"-->
|
||||
<!-- launcher:x="1"-->
|
||||
<!-- launcher:y="0" />-->
|
||||
</favorites>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2009 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Tab10CPro_GK exclusive 5x5 layout (5 columns / 5 rows, 5 hotseat icons) -->
|
||||
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.uiuios">
|
||||
|
||||
<!-- Hotseat (screen 0..4 for 5x5, without com.aoleyun.info) -->
|
||||
<favorite
|
||||
launcher:className="com.aoleyun.sn.activity.SplashActivity"
|
||||
launcher:container="-101"
|
||||
launcher:packageName="com.aoleyun.sn"
|
||||
launcher:screen="0"
|
||||
launcher:x="0"
|
||||
launcher:y="0" />
|
||||
<favorite
|
||||
launcher:className="com.aoleyun.appstore.activity.SplashActivity"
|
||||
launcher:container="-101"
|
||||
launcher:packageName="com.aoleyun.appstore"
|
||||
launcher:screen="1"
|
||||
launcher:x="1"
|
||||
launcher:y="0" />
|
||||
<favorite
|
||||
launcher:className="com.android.settings.Settings"
|
||||
launcher:container="-101"
|
||||
launcher:packageName="com.android.settings"
|
||||
launcher:screen="2"
|
||||
launcher:x="2"
|
||||
launcher:y="0" />
|
||||
<favorite
|
||||
launcher:className="com.aoleyun.browser.activity.main.MainActivity"
|
||||
launcher:container="-101"
|
||||
launcher:packageName="com.aoleyun.browser"
|
||||
launcher:screen="3"
|
||||
launcher:x="3"
|
||||
launcher:y="0" />
|
||||
<favorite
|
||||
launcher:className="com.aoleyun.sn.activity.EyeProtectionActivity"
|
||||
launcher:container="-101"
|
||||
launcher:packageName="com.aoleyun.sn"
|
||||
launcher:screen="4"
|
||||
launcher:x="4"
|
||||
launcher:y="0" />
|
||||
</favorites>
|
||||
@@ -149,4 +149,51 @@
|
||||
|
||||
</grid-option>
|
||||
|
||||
<grid-option
|
||||
launcher:name="aiudu"
|
||||
launcher:numRows="4"
|
||||
launcher:numColumns="6"
|
||||
launcher:numFolderRows="3"
|
||||
launcher:numFolderColumns="3"
|
||||
launcher:numHotseatIcons="6"
|
||||
launcher:defaultLayoutId="@xml/default_workspace_aiudu" >
|
||||
|
||||
<display-option
|
||||
launcher:name="AiUDU Phone"
|
||||
launcher:minWidthDps="406"
|
||||
launcher:minHeightDps="694"
|
||||
launcher:iconImageSize="70"
|
||||
launcher:iconTextSize="14.4"
|
||||
launcher:canBeDefault="true" />
|
||||
|
||||
<!-- <display-option-->
|
||||
<!-- launcher:name="Shorter Stubby"-->
|
||||
<!-- launcher:minWidthDps="255"-->
|
||||
<!-- launcher:minHeightDps="400"-->
|
||||
<!-- launcher:iconImageSize="48"-->
|
||||
<!-- launcher:iconTextSize="13.0"-->
|
||||
<!-- launcher:canBeDefault="true" />-->
|
||||
|
||||
</grid-option>
|
||||
|
||||
<!-- Tab10CPro_GK (1860x2480, density 300) exclusive 5x5 profile with larger icons -->
|
||||
<grid-option
|
||||
launcher:name="tab10cpro_5x5"
|
||||
launcher:numRows="5"
|
||||
launcher:numColumns="5"
|
||||
launcher:numFolderRows="4"
|
||||
launcher:numFolderColumns="4"
|
||||
launcher:numHotseatIcons="5"
|
||||
launcher:defaultLayoutId="@xml/default_workspace_tab10cpro_5x5" >
|
||||
|
||||
<display-option
|
||||
launcher:name="Tab10CPro 5x5"
|
||||
launcher:minWidthDps="992"
|
||||
launcher:minHeightDps="1323"
|
||||
launcher:iconImageSize="100"
|
||||
launcher:iconTextSize="15.0"
|
||||
launcher:canBeDefault="true" />
|
||||
|
||||
</grid-option>
|
||||
|
||||
</profiles>
|
||||
@@ -1,2 +1,3 @@
|
||||
include ':IconLoader'
|
||||
project(':IconLoader').projectDir = new File(rootDir, 'iconloaderlib')
|
||||
rootProject.name='酷比桌面'
|
||||
@@ -4,6 +4,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.model.LoaderTask;
|
||||
import com.aoleyun.os.util.ResourceBasedOverride;
|
||||
|
||||
public class AppFilter implements ResourceBasedOverride {
|
||||
@@ -13,6 +14,9 @@ public class AppFilter implements ResourceBasedOverride {
|
||||
}
|
||||
|
||||
public boolean shouldShowApp(ComponentName app) {
|
||||
if (LoaderTask.SYSTEM_HIDE_APP.contains(app.getPackageName())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import android.animation.FloatArrayEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.ColorMatrix;
|
||||
@@ -31,6 +32,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Property;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -39,12 +41,12 @@ import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.anim.Interpolators;
|
||||
import com.aoleyun.os.dragndrop.DragController;
|
||||
import com.aoleyun.os.dragndrop.DragLayer;
|
||||
import com.aoleyun.os.dragndrop.DragOptions;
|
||||
import com.aoleyun.os.dragndrop.DragView;
|
||||
import com.aoleyun.os.uiuiutils.JgyUtils;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.Target;
|
||||
import com.aoleyun.os.util.Themes;
|
||||
import com.aoleyun.os.util.Thunk;
|
||||
@@ -241,12 +243,22 @@ public abstract class ButtonDropTarget extends TextView
|
||||
@Override
|
||||
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
|
||||
mActive = supportsDrop(dragObject.dragInfo);
|
||||
/*add 2022-01-06 15:28:19 通过info获取包名判断是否为强制应用*/
|
||||
Intent intent = dragObject.dragInfo.getIntent();
|
||||
if (intent != null) {
|
||||
String pkg = intent.getComponent().getPackageName();
|
||||
Log.e("beginDrag", "beginDrag: " + pkg);
|
||||
if (JgyUtils.getInstance().isEnforceApp(pkg)) {
|
||||
mActive = false;
|
||||
}
|
||||
}
|
||||
mDrawable.setColorFilter(null);
|
||||
if (mCurrentColorAnim != null) {
|
||||
mCurrentColorAnim.cancel();
|
||||
mCurrentColorAnim = null;
|
||||
}
|
||||
setTextColor(mOriginalTextColor);
|
||||
Log.e("ButtonDropTarget", "onDragStart: " + mActive);
|
||||
setVisibility(mActive ? View.VISIBLE : View.GONE);
|
||||
|
||||
mAccessibleDrag = options.isAccessibleDrag;
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Parcelable;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.AttributeSet;
|
||||
@@ -578,7 +579,11 @@ public class CellLayout extends ViewGroup implements Transposable {
|
||||
// Hotseat icons - remove text
|
||||
if (child instanceof BubbleTextView) {
|
||||
BubbleTextView bubbleChild = (BubbleTextView) child;
|
||||
bubbleChild.setTextVisibility(mContainerType != HOTSEAT);
|
||||
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
bubbleChild.setTextVisibility(true);
|
||||
} else {
|
||||
bubbleChild.setTextVisibility(mContainerType != HOTSEAT);
|
||||
}
|
||||
}
|
||||
|
||||
child.setScaleX(mChildScale);
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.aoleyun.os.dragndrop.DragOptions;
|
||||
import com.aoleyun.os.logging.LoggerUtils;
|
||||
@@ -102,7 +101,6 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
setContentDescription(mText);
|
||||
requestLayout();
|
||||
setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +118,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
if (LauncherAppState.isDisableAllApps()) {
|
||||
mControlType = isCanDrop(item) ? ControlType.REMOVE_TARGET
|
||||
: ControlType.CANCEL_TARGET;
|
||||
// Log.e("setControlTypeBasedOnDragSource", "mControlType: " + mControlType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.res.Resources;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
@@ -206,28 +207,23 @@ public class DeviceProfile {
|
||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding);
|
||||
// Add a bit of space between nav bar and hotseat in vertical bar layout.
|
||||
hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? verticalDragHandleSizePx : 0;
|
||||
hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
|
||||
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
|
||||
: (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size)
|
||||
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
|
||||
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
|
||||
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
|
||||
: (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size_aiudu)
|
||||
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
|
||||
} else {
|
||||
hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
|
||||
? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
|
||||
: (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size)
|
||||
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
|
||||
}
|
||||
|
||||
|
||||
// Calculate all of the remaining variables.
|
||||
updateAvailableDimensions(dm, res);
|
||||
|
||||
// Now that we have all of the variables calculated, we can tune certain sizes.
|
||||
if (!isVerticalBarLayout() && isPhone && isTallDevice) {
|
||||
// We increase the hotseat size when there is extra space.
|
||||
// ie. For a display with a large aspect ratio, we can keep the icons on the workspace
|
||||
// in portrait mode closer together by adding more height to the hotseat.
|
||||
// Note: This calculation was created after noticing a pattern in the design spec.
|
||||
int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx * 2
|
||||
- verticalDragHandleSizePx;
|
||||
hotseatBarSizePx += extraSpace;
|
||||
hotseatBarBottomPaddingPx += extraSpace;
|
||||
|
||||
// Recalculate the available dimensions using the new hotseat size.
|
||||
updateAvailableDimensions(dm, res);
|
||||
}
|
||||
updateWorkspacePadding();
|
||||
|
||||
// This is done last, after iconSizePx is calculated above.
|
||||
@@ -464,11 +460,8 @@ public class DeviceProfile {
|
||||
((inv.numColumns - 1) * cellWidthPx)));
|
||||
availablePaddingX = (int) Math.min(availablePaddingX,
|
||||
widthPx * MAX_HORIZONTAL_PADDING_PERCENT);
|
||||
int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom
|
||||
- (2 * inv.numRows * cellHeightPx) - hotseatBarTopPaddingPx
|
||||
- hotseatBarBottomPaddingPx);
|
||||
padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2,
|
||||
availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
|
||||
padding.set(availablePaddingX / 2, edgeMarginPx,
|
||||
availablePaddingX / 2, paddingBottom);
|
||||
} else {
|
||||
// Pad the top and bottom of the workspace with search/hotseat bar sizes
|
||||
padding.set(desiredWorkspaceLeftRightMarginPx,
|
||||
|
||||
@@ -213,6 +213,7 @@ public class DropTargetBar extends FrameLayout
|
||||
|
||||
float finalAlpha = mVisible ? 1 : 0;
|
||||
if (Float.compare(getAlpha(), finalAlpha) != 0) {
|
||||
/*控制顶部卸载按钮显示的*/
|
||||
setVisibility(View.VISIBLE);
|
||||
mCurrentAnimation = animate().alpha(finalAlpha)
|
||||
.setInterpolator(DEFAULT_INTERPOLATOR)
|
||||
|
||||
@@ -24,6 +24,9 @@ import android.annotation.TargetApi;
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
@@ -32,6 +35,7 @@ import android.content.res.TypedArray;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -54,6 +58,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -66,6 +71,7 @@ public class InvariantDeviceProfile {
|
||||
new MainThreadInitializedObject<>(InvariantDeviceProfile::new);
|
||||
|
||||
private static final String KEY_IDP_GRID_NAME = "idp_grid_name";
|
||||
private static final String KEY_LAST_VERSION = "idp_last_version";
|
||||
|
||||
private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48;
|
||||
|
||||
@@ -124,7 +130,8 @@ public class InvariantDeviceProfile {
|
||||
private OverlayMonitor mOverlayMonitor;
|
||||
|
||||
@VisibleForTesting
|
||||
public InvariantDeviceProfile() {}
|
||||
public InvariantDeviceProfile() {
|
||||
}
|
||||
|
||||
private InvariantDeviceProfile(InvariantDeviceProfile p) {
|
||||
numRows = p.numRows;
|
||||
@@ -144,6 +151,9 @@ public class InvariantDeviceProfile {
|
||||
|
||||
@TargetApi(23)
|
||||
private InvariantDeviceProfile(Context context) {
|
||||
// On app upgrade, drop the previously saved grid for Tab10CPro_GK so the dedicated
|
||||
// 5x5 profile (icon size / grid / default layout) is re-selected.
|
||||
maybeResetGridOnUpgrade(context);
|
||||
initGrid(context, Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null));
|
||||
mConfigMonitor = new ConfigMonitor(context,
|
||||
APPLY_CONFIG_AT_RUNTIME.get() ? this::onConfigChanged : this::killProcess);
|
||||
@@ -160,6 +170,41 @@ public class InvariantDeviceProfile {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When the app's versionCode is raised, clear the previously saved grid name for
|
||||
* Tab10CPro_GK so that {@link #initGrid} re-selects the dedicated 5x5 profile
|
||||
* (icon size / grid / default layout) instead of keeping a stale saved configuration.
|
||||
* A same-version reinstall does NOT trigger a reset. Other models are unaffected.
|
||||
*/
|
||||
private static void maybeResetGridOnUpgrade(Context context) {
|
||||
if (!"Tab10CPro_GK".equals(Build.MODEL)) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences prefs = Utilities.getPrefs(context);
|
||||
long currentVersion = getCurrentVersionCode(context);
|
||||
long lastVersion = prefs.getLong(KEY_LAST_VERSION, -1);
|
||||
if (lastVersion != -1 && lastVersion < currentVersion) {
|
||||
Log.e(TAG, "maybeResetGridOnUpgrade: version raised " + lastVersion
|
||||
+ " -> " + currentVersion + ", reset saved grid: "
|
||||
+ prefs.getString(KEY_IDP_GRID_NAME, null));
|
||||
prefs.edit().remove(KEY_IDP_GRID_NAME).apply();
|
||||
}
|
||||
prefs.edit().putLong(KEY_LAST_VERSION, currentVersion).apply();
|
||||
}
|
||||
|
||||
private static long getCurrentVersionCode(Context context) {
|
||||
try {
|
||||
PackageInfo info = context.getPackageManager()
|
||||
.getPackageInfo(context.getPackageName(), 0);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
return info.getLongVersionCode();
|
||||
}
|
||||
return info.versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve system defined or RRO overriden icon shape.
|
||||
*/
|
||||
@@ -182,6 +227,9 @@ public class InvariantDeviceProfile {
|
||||
display.getCurrentSizeRange(smallestSize, largestSize);
|
||||
|
||||
ArrayList<DisplayOption> allOptions = getPredefinedDeviceProfiles(context, gridName);
|
||||
for (DisplayOption displayOption : allOptions) {
|
||||
Log.e(TAG, "initGrid: " + displayOption.grid.name);
|
||||
}
|
||||
// This guarantees that width < height
|
||||
float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm);
|
||||
float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), dm);
|
||||
@@ -190,9 +238,35 @@ public class InvariantDeviceProfile {
|
||||
Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps),
|
||||
dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps)));
|
||||
DisplayOption interpolatedDisplayOption =
|
||||
invDistWeightedInterpolate(minWidthDps, minHeightDps, allOptions);
|
||||
|
||||
GridOption closestProfile = allOptions.get(0).grid;
|
||||
invDistWeightedInterpolate(minWidthDps, minHeightDps, allOptions);
|
||||
GridOption closestProfile = allOptions.stream()
|
||||
.filter(new Predicate<DisplayOption>() {
|
||||
@Override
|
||||
public boolean test(DisplayOption displayOption) {
|
||||
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
|
||||
return "aiudu".equals(displayOption.grid.name);
|
||||
} else if ("Tab10CPro_GK".equals(Build.MODEL)) {
|
||||
// Tab10CPro_GK (1860x2480, density 300) exclusive 5x5 profile
|
||||
return "tab10cpro_5x5".equals(displayOption.grid.name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.map(new java.util.function.Function<DisplayOption, GridOption>() {
|
||||
@Override
|
||||
public GridOption apply(DisplayOption displayOption) {
|
||||
return displayOption.grid;
|
||||
}
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(allOptions.get(0).grid);
|
||||
Log.e(TAG, "initGrid: deviceModel=" + Build.MODEL
|
||||
+ ", minWidthDps=" + minWidthDps + ", minHeightDps=" + minHeightDps
|
||||
+ ", selectedGrid=" + closestProfile.name
|
||||
+ ", numRows=" + closestProfile.numRows
|
||||
+ ", numColumns=" + closestProfile.numColumns
|
||||
+ ", numHotseatIcons=" + closestProfile.numHotseatIcons
|
||||
+ ", defaultLayoutId=" + closestProfile.defaultLayoutId);
|
||||
numRows = closestProfile.numRows;
|
||||
numColumns = closestProfile.numColumns;
|
||||
numHotseatIcons = closestProfile.numHotseatIcons;
|
||||
@@ -345,7 +419,7 @@ public class InvariantDeviceProfile {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException|XmlPullParserException e) {
|
||||
} catch (IOException | XmlPullParserException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -373,7 +447,7 @@ public class InvariantDeviceProfile {
|
||||
|
||||
private int getLauncherIconDensity(int requiredSize) {
|
||||
// Densities typically defined by an app.
|
||||
int[] densityBuckets = new int[] {
|
||||
int[] densityBuckets = new int[]{
|
||||
DisplayMetrics.DENSITY_LOW,
|
||||
DisplayMetrics.DENSITY_MEDIUM,
|
||||
DisplayMetrics.DENSITY_TV,
|
||||
@@ -397,7 +471,7 @@ public class InvariantDeviceProfile {
|
||||
|
||||
/**
|
||||
* Apply any Partner customization grid overrides.
|
||||
*
|
||||
* <p>
|
||||
* Currently we support: all apps row / column count.
|
||||
*/
|
||||
private void applyPartnerDeviceProfileOverrides(Context context, DisplayMetrics dm) {
|
||||
@@ -413,7 +487,7 @@ public class InvariantDeviceProfile {
|
||||
|
||||
@VisibleForTesting
|
||||
static DisplayOption invDistWeightedInterpolate(float width, float height,
|
||||
ArrayList<DisplayOption> points) {
|
||||
ArrayList<DisplayOption> points) {
|
||||
float weights = 0;
|
||||
|
||||
DisplayOption p = points.get(0);
|
||||
@@ -456,8 +530,8 @@ public class InvariantDeviceProfile {
|
||||
// We will use these two data points to extrapolate how much the wallpaper parallax effect
|
||||
// to span (ie travel) at any aspect ratio:
|
||||
|
||||
final float ASPECT_RATIO_LANDSCAPE = 16/10f;
|
||||
final float ASPECT_RATIO_PORTRAIT = 10/16f;
|
||||
final float ASPECT_RATIO_LANDSCAPE = 16 / 10f;
|
||||
final float ASPECT_RATIO_PORTRAIT = 10 / 16f;
|
||||
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f;
|
||||
final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.WallpaperManager;
|
||||
import android.app.role.RoleManager;
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
@@ -46,9 +47,11 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Process;
|
||||
import android.os.StrictMode;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.TextKeyListener;
|
||||
@@ -70,15 +73,13 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.aoleyun.os.DropTarget.DragObject;
|
||||
import com.aoleyun.os.TTUtils.APKUtils;
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.aoleyun.os.allapps.AllAppsContainerView;
|
||||
import com.aoleyun.os.allapps.AllAppsStore;
|
||||
import com.aoleyun.os.allapps.AllAppsTransitionController;
|
||||
import com.aoleyun.os.allapps.DiscoveryBounce;
|
||||
import com.aoleyun.os.anim.PropertyListBuilder;
|
||||
import com.aoleyun.os.base.MyApplication;
|
||||
import com.aoleyun.os.comm.CommonConfig;
|
||||
import com.aoleyun.os.compat.AppWidgetManagerCompat;
|
||||
import com.aoleyun.os.compat.LauncherAppsCompatVO;
|
||||
import com.aoleyun.os.config.FeatureFlags;
|
||||
@@ -91,8 +92,6 @@ import com.aoleyun.os.folder.FolderIcon;
|
||||
import com.aoleyun.os.folder.FolderIconPreviewVerifier;
|
||||
import com.aoleyun.os.graphics.RotationMode;
|
||||
import com.aoleyun.os.icons.IconCache;
|
||||
import com.aoleyun.os.jpush.ExampleUtil;
|
||||
import com.aoleyun.os.jpush.LocalBroadcastManager;
|
||||
import com.aoleyun.os.keyboard.CustomActionsPopup;
|
||||
import com.aoleyun.os.keyboard.ViewGroupFocusHelper;
|
||||
import com.aoleyun.os.logging.FileLog;
|
||||
@@ -101,12 +100,11 @@ import com.aoleyun.os.logging.UserEventDispatcher;
|
||||
import com.aoleyun.os.logging.UserEventDispatcher.UserEventDelegate;
|
||||
import com.aoleyun.os.model.AppLaunchTracker;
|
||||
import com.aoleyun.os.model.ModelWriter;
|
||||
import com.aoleyun.os.network.AppPasswdBean;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetWorkManager;
|
||||
import com.aoleyun.os.network.NewestAppUpdateResult;
|
||||
import com.aoleyun.os.network.api.AddAppLog;
|
||||
import com.aoleyun.os.network.NetInterfaceManager;
|
||||
import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.NewestAppUpdateResult;
|
||||
import com.aoleyun.os.notification.NotificationListener;
|
||||
import com.aoleyun.os.pageindicators.PageIndicatorDots;
|
||||
import com.aoleyun.os.popup.PopupContainerWithArrow;
|
||||
@@ -118,7 +116,10 @@ import com.aoleyun.os.states.RotationHelper;
|
||||
import com.aoleyun.os.testing.TestProtocol;
|
||||
import com.aoleyun.os.touch.ItemClickHandler;
|
||||
import com.aoleyun.os.uioverrides.UiFactory;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.aoleyun.os.uiuiutils.ApkUtils;
|
||||
import com.aoleyun.os.uiuiutils.JgyUtils;
|
||||
import com.aoleyun.os.uiuiutils.TimeUtils;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.Action;
|
||||
import com.aoleyun.os.userevent.nano.LauncherLogProto.ContainerType;
|
||||
@@ -154,6 +155,7 @@ import com.aoleyun.os.widget.custom.CustomWidgetParser;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.io.File;
|
||||
@@ -166,11 +168,11 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
@@ -204,6 +206,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
public static final String TAG = "Launcher";
|
||||
static final boolean LOGD = false;
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
static final boolean DEBUG_STRICT_MODE = false;
|
||||
|
||||
private static final int REQUEST_CREATE_SHORTCUT = 1;
|
||||
@@ -332,13 +336,14 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
private DeviceProfile mStableDeviceProfile;
|
||||
private RotationMode mRotationMode = RotationMode.NORMAL;
|
||||
|
||||
public static boolean isForeground = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
RaceConditionTracker.onEvent(ON_CREATE_EVT, ENTER);
|
||||
Observable.create(subscribe)
|
||||
.throttleFirst(1, TimeUnit.MINUTES)
|
||||
Observable.create(passwdSubscribe)
|
||||
.throttleFirst(1, TimeUnit.HOURS)
|
||||
.subscribe(passwdObserver);
|
||||
Observable.create(updateSubscribe)
|
||||
.throttleFirst(6, TimeUnit.HOURS)
|
||||
.subscribe(updateObserver);
|
||||
startService(new Intent(Launcher.this, MainService.class));
|
||||
if (DEBUG_STRICT_MODE) {
|
||||
@@ -356,6 +361,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
.build());
|
||||
}
|
||||
TraceHelper.beginSection("Launcher-onCreate");
|
||||
Log.e(TAG, "onCreate: " + Utils.getSerial(Launcher.this));
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
TraceHelper.partitionSection("Launcher-onCreate", "super call");
|
||||
@@ -420,7 +426,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
}
|
||||
|
||||
if (!isDefaultHome()) {
|
||||
setDefaultL();
|
||||
// setDefaultL();
|
||||
// setRoleHolderAsUser(this, BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
SharedPreferences sharedPref = getPreferences(MODE_PRIVATE);
|
||||
int i = sharedPref.getInt("SetWallPaper", 0);
|
||||
@@ -468,55 +475,24 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
}
|
||||
}
|
||||
});
|
||||
registerMessageReceiver(); // used for receive msg
|
||||
JPushInterface.init(this);
|
||||
String rid = JPushInterface.getRegistrationID(this);
|
||||
if (!TextUtils.isEmpty(rid)) {
|
||||
Log.e("setJpushAlias", "RegId:" + rid);
|
||||
}
|
||||
JPushInterface.getAlias(this, new Random().nextInt(100));
|
||||
}
|
||||
|
||||
|
||||
//for receive customer msg from jpush server
|
||||
private MessageReceiver mMessageReceiver;
|
||||
public static final String MESSAGE_RECEIVED_ACTION = "com.example.jpushdemo.MESSAGE_RECEIVED_ACTION";
|
||||
public static final String KEY_TITLE = "title";
|
||||
public static final String KEY_MESSAGE = "message";
|
||||
public static final String KEY_EXTRAS = "extras";
|
||||
|
||||
public void registerMessageReceiver() {
|
||||
mMessageReceiver = new MessageReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(MESSAGE_RECEIVED_ACTION);
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, filter);
|
||||
}
|
||||
|
||||
public class MessageReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
if (MESSAGE_RECEIVED_ACTION.equals(intent.getAction())) {
|
||||
String messge = intent.getStringExtra(KEY_MESSAGE);
|
||||
String extras = intent.getStringExtra(KEY_EXTRAS);
|
||||
StringBuilder showMsg = new StringBuilder();
|
||||
showMsg.append(KEY_MESSAGE + " : " + messge + "\n");
|
||||
if (!ExampleUtil.isEmpty(extras)) {
|
||||
showMsg.append(KEY_EXTRAS + " : " + extras + "\n");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
JgyUtils.getInstance().wakeUpAppstore();
|
||||
JgyUtils.getInstance().wakeUpDeviceInfo();
|
||||
}
|
||||
|
||||
private void SetWallPaper() {
|
||||
Log.e(TAG, "SetWallPaper: ");
|
||||
//利用WallpaparManager,添加权限set_wallpaper
|
||||
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
|
||||
try {
|
||||
wallpaperManager.setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.wallpapers));
|
||||
if ("Aiud_A8_ag_1095".equals(Build.MODEL)
|
||||
|| JgyUtils.getInstance().checkAppPlatform() == JgyUtils.seewoPlatform
|
||||
) {
|
||||
wallpaperManager.setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.wallpapers_aiudu));
|
||||
} else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.QualcommPlatform) {
|
||||
// wallpaperManager.clear();
|
||||
} else {
|
||||
wallpaperManager.setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.wallpapers));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.e("TT", e.getMessage());
|
||||
@@ -569,6 +545,42 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
}
|
||||
}
|
||||
|
||||
// private void setDefault() {
|
||||
// String mRoleName ="android.app.role.HOME";
|
||||
// final Intent intent = new Intent(Intent.ACTION_MANAGE_DEFAULT_APP)
|
||||
// .putExtra(Intent.EXTRA_ROLE_NAME, mRoleName);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
|
||||
public void setRoleHolderAsUser(Context context, String packageName) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
String roleName = "android.app.role.HOME";
|
||||
boolean add = true;
|
||||
int flags = 0;
|
||||
UserHandle user = Process.myUserHandle();
|
||||
Log.i("settingssssssstemf", (add ? "Adding" : "Removing") + " package as role holder, role: "
|
||||
+ roleName + ", package: " + packageName);
|
||||
if (JgyUtils.getInstance().checkAppPlatform() != JgyUtils.MTKPlatform) {
|
||||
RoleManager roleManager = context.getSystemService(RoleManager.class);
|
||||
Executor executor = context.getMainExecutor();
|
||||
Consumer<Boolean> callback = successful -> {
|
||||
if (successful) {
|
||||
Log.d("settingssssssstemf", "Package " + (add ? "added" : "removed")
|
||||
+ " as role holder, role: " + roleName + ", package: " + packageName);
|
||||
} else {
|
||||
Log.d("settingssssssstemf", "Failed to " + (add ? "add" : "remove")
|
||||
+ " package as role holder, role: " + roleName + ", package: "
|
||||
+ packageName);
|
||||
}
|
||||
};
|
||||
roleManager.addRoleHolderAsUser(roleName, packageName, flags, user, executor, callback);
|
||||
Log.i("settingssssssstemf", "addRoleHolderAsUser done");
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private TimeChangedReceiver mTimeChangedReceiver;
|
||||
|
||||
//监听时间和日期变化
|
||||
@@ -588,17 +600,18 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (Intent.ACTION_DATE_CHANGED.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "data changed");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "data changed");
|
||||
} else if (Intent.ACTION_TIME_CHANGED.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "time changed");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "time changed");
|
||||
} else if (Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "timezone changed");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "timezone changed");
|
||||
} else if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) {
|
||||
Log.e("fht", "TimeChangedReceiver:" + "time tick");
|
||||
// Log.e("fht", "TimeChangedReceiver:" + "time tick");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnterAnimationComplete() {
|
||||
super.onEnterAnimationComplete();
|
||||
@@ -1090,90 +1103,54 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
}
|
||||
RaceConditionTracker.onEvent(ON_START_EVT, ENTER);
|
||||
super.onStart();
|
||||
removeRecentTask();
|
||||
String packagename = MyApplication.getInstance().getAppPackageName();
|
||||
Log.e("SendcloseApp", "packagename=" + packagename);
|
||||
if (packagename != null && packagename.length() > 0) {
|
||||
SendcloseApp(packagename);
|
||||
// if (!APKUtils.isSystemApp(this, packagename) && !Arrays.asList(ItemClickHandler.packages).contains(packagename)) {
|
||||
// try {
|
||||
// AppInformation app = getInfoFromPackageName(packagename);
|
||||
// if (app != null) {
|
||||
// long time = app.getUsedTimebyDay() / 1000;
|
||||
// Log.e("fht", "返回运行时间: " + DateUtils.formatElapsedTime(time));
|
||||
// Log.e("fht", "返回运行时间: " + time);
|
||||
//
|
||||
//// if (userInfo != null) {
|
||||
//// HTTPInterface.sendTimeLog(handler, userInfo, app.getLabel(), 2, time - MyApplication.getInstance().getRunTime());
|
||||
//// } else {
|
||||
//// Log.e("fht", "userInfo = null");
|
||||
//// }
|
||||
// } else {
|
||||
// Log.e("fht", "app = null" + packagename);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// Log.e("fht", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// Log.e("packagename", "packagename is null");
|
||||
}
|
||||
|
||||
if (mLauncherCallbacks != null) {
|
||||
mLauncherCallbacks.onStart();
|
||||
}
|
||||
mAppWidgetHost.setListenIfResumed(true);
|
||||
RaceConditionTracker.onEvent(ON_START_EVT, EXIT);
|
||||
|
||||
/*移除最近任务列表*/
|
||||
TimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||
removeRecentTask();
|
||||
String packageName = TimeUtils.getInstance().getAppPackageName();
|
||||
if (TextUtils.isEmpty(packageName)) {
|
||||
Log.e("onStart", "app = null" + packageName);
|
||||
return;
|
||||
}
|
||||
sendAppUsageRecord(packageName);
|
||||
}
|
||||
|
||||
private static void SendcloseApp(String packageName) {
|
||||
PackageManager pm = MyApplication.getInstance().getPackageManager();
|
||||
PackageInfo appInfo = null;
|
||||
try {
|
||||
appInfo = pm.getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null != appInfo) {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = appInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = appInfo.versionCode;
|
||||
}
|
||||
AddAppLog appLog = NetWorkManager.getInstance().getapplogControl();
|
||||
String sn = Utils.getSerial();
|
||||
appLog.addLog(sn, packageName, appVersionCode, System.currentTimeMillis() / 1000, 2)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
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 onNext(BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
if (code == 200) {
|
||||
Log.e("SendcloseApp", "onNext: " + code + baseResponse.data);
|
||||
} else {
|
||||
Log.e("SendcloseApp", "onNext: " + code + baseResponse.msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendcloseApp", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendAppUsageRecord", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("sendAppUsageRecord", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1219,12 +1196,9 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.e(TAG, "onResume: ");
|
||||
RaceConditionTracker.onEvent(ON_RESUME_EVT, ENTER);
|
||||
TraceHelper.beginSection("ON_RESUME");
|
||||
super.onResume();
|
||||
removeRecentTask();
|
||||
start.onstar(System.currentTimeMillis());
|
||||
TraceHelper.partitionSection("ON_RESUME", "superCall");
|
||||
|
||||
mHandler.removeCallbacks(mHandleDeferredResume);
|
||||
@@ -1245,24 +1219,41 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
|
||||
TraceHelper.endSection("ON_RESUME");
|
||||
RaceConditionTracker.onEvent(ON_RESUME_EVT, EXIT);
|
||||
isForeground = true;
|
||||
MyApplication.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
MyApplication.getInstance().setOnClickTime(System.currentTimeMillis());
|
||||
HTTPInterface.getAppPasswd();
|
||||
start.onstar(System.currentTimeMillis());
|
||||
|
||||
Log.e(TAG, "onResume: ");
|
||||
/*打开霸屏应用*/
|
||||
String always_top_packagename = Settings.System.getString(getContentResolver(), "always_top_packagename");
|
||||
if (!TextUtils.isEmpty(always_top_packagename)) {
|
||||
APKUtils.openPackage(Launcher.this, always_top_packagename);
|
||||
if ("com.tongyi.aistudent".equalsIgnoreCase(always_top_packagename)) {
|
||||
ApkUtils.openPackage(Launcher.this, "com.tongyi.aistudent", "com.tongyi.aistudent.activity.login.SplashActivity");
|
||||
} else {
|
||||
ApkUtils.openPackage(Launcher.this, always_top_packagename);
|
||||
}
|
||||
}
|
||||
|
||||
mUpdate.checkUpdate(System.currentTimeMillis());
|
||||
mPasswd.getPassword(System.currentTimeMillis());
|
||||
TimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
NetInterfaceManager.getInstance().sendRunningApp(Launcher.this);
|
||||
JgyUtils.getInstance().wakeUpAppstore();
|
||||
JgyUtils.getInstance().wakeUpDeviceInfo();
|
||||
checkIsRest();
|
||||
JgyUtils.getInstance().checkAoleyunApp();
|
||||
}
|
||||
|
||||
private void checkIsRest() {
|
||||
int desktop_clear = Settings.Global.getInt(getContentResolver(), "desktop_clear", 0);
|
||||
int aihuaUnlock = Settings.Global.getInt(getContentResolver(), "Aihua_unlock_state", 0);
|
||||
if ((!JgyUtils.getInstance().getDeviceIsLocked() || aihuaUnlock == 1) && desktop_clear != 1) {
|
||||
Settings.Global.putInt(getContentResolver(), "desktop_clear", 1);
|
||||
JgyUtils.getInstance().cleanAoleLauncher3Cache();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeRecentTask() {
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String ApplicationLock = MMKV.defaultMMKV().decodeString("ApplicationLock");
|
||||
String ApplicationLock = mMMKV.decodeString("ApplicationLock");
|
||||
Type type = new TypeToken<List<AppPasswdBean>>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
@@ -1270,29 +1261,65 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
if (appPasswdBeans != null) {
|
||||
for (AppPasswdBean bean : appPasswdBeans) {
|
||||
Log.e(TAG, "removeRecentTask: " + bean.getApp_package());
|
||||
Utils.removeTask(bean.getApp_package());
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
Utils.removeTask(bean.getApp_package());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private Passwd mPasswd;
|
||||
|
||||
private Start start;
|
||||
|
||||
private interface Start {
|
||||
void onstar(long time);
|
||||
private interface Passwd {
|
||||
void getPassword(long time);
|
||||
}
|
||||
|
||||
private ObservableOnSubscribe<Long> subscribe = new ObservableOnSubscribe<Long>() {
|
||||
private ObservableOnSubscribe<Long> passwdSubscribe = new ObservableOnSubscribe<Long>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter emitter) throws Exception {
|
||||
start = emitter::onNext;
|
||||
mPasswd = emitter::onNext;
|
||||
}
|
||||
};
|
||||
|
||||
private Observer<Long> passwdObserver = new Observer<Long>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("passwdObserver", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Long aLong) {
|
||||
Log.e("passwdObserver", "onNext: " + aLong);
|
||||
NetInterfaceManager.getInstance().getAppPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("passwdObserver", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("passwdObserver", "onComplete: ");
|
||||
}
|
||||
};
|
||||
|
||||
private Update mUpdate;
|
||||
|
||||
private interface Update {
|
||||
void checkUpdate(long time);
|
||||
}
|
||||
|
||||
private ObservableOnSubscribe<Long> updateSubscribe = new ObservableOnSubscribe<Long>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter emitter) throws Exception {
|
||||
mUpdate = emitter::onNext;
|
||||
}
|
||||
};
|
||||
|
||||
private Observer<Long> updateObserver = new Observer<Long>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("updateObserver", "onSubscribe: ");
|
||||
@@ -1316,10 +1343,11 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
};
|
||||
|
||||
private void checkUpdate() {
|
||||
NetWorkManager.getInstance().getCheckUpdateObservable()
|
||||
NetInterfaceManager.getInstance()
|
||||
.getCheckUpdateObservable()
|
||||
.getCheckUpdate(BuildConfig.APPLICATION_ID,
|
||||
BuildConfig.VERSION_CODE,
|
||||
JGYUtils.getInstance().checkAppPlatform())
|
||||
JgyUtils.getInstance().checkAppPlatform())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse<NewestAppUpdateResult>>() {
|
||||
@@ -1353,7 +1381,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
}
|
||||
|
||||
private void checkAppUpdate(NewestAppUpdateResult result) {
|
||||
int app_version_code = result.getVersion_code();
|
||||
int version_code = result.getVersion_code();
|
||||
String app_package = result.getApp_package();
|
||||
String url = result.getUrl();
|
||||
PackageInfo info = null;
|
||||
@@ -1362,7 +1390,13 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (info == null || info.versionCode < app_version_code || info.getLongVersionCode() < app_version_code) {
|
||||
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())
|
||||
@@ -1391,8 +1425,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
if (mLauncherCallbacks != null) {
|
||||
mLauncherCallbacks.onPause();
|
||||
}
|
||||
isForeground = false;
|
||||
// removeRecentTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1901,7 +1933,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
if (mLauncherCallbacks != null) {
|
||||
mLauncherCallbacks.onDestroy();
|
||||
}
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
|
||||
}
|
||||
|
||||
public LauncherAccessibilityDelegate getAccessibilityDelegate() {
|
||||
@@ -2082,6 +2113,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
FolderIcon addFolder(CellLayout layout, int container, final int screenId, int cellX,
|
||||
int cellY) {
|
||||
final FolderInfo folderInfo = new FolderInfo();
|
||||
/*修改默认文件夹名*/
|
||||
folderInfo.title = getText(R.string.folder_name);
|
||||
|
||||
// Update the model
|
||||
|
||||
@@ -273,7 +273,7 @@ public class LauncherModel extends BroadcastReceiver
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (DEBUG_RECEIVER) Log.d(TAG, "onReceive intent=" + intent);
|
||||
Log.e("fht","onReceive intent=" + intent);
|
||||
// Log.e("fht","onReceive intent=" + intent);
|
||||
|
||||
final String action = intent.getAction();
|
||||
if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
|
||||
@@ -317,12 +317,20 @@ public class LauncherModel extends BroadcastReceiver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新日历图标
|
||||
* @param user
|
||||
*/
|
||||
void changedData(UserHandle user) {
|
||||
final String calendar = "com.android.calendar";
|
||||
enqueueModelUpdateTask(
|
||||
new PackageUpdatedTask(PackageUpdatedTask.OP_UPDATE, user, calendar));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时钟图标
|
||||
* @param user
|
||||
*/
|
||||
void changedTime(UserHandle user) {
|
||||
final String deskclock = "com.android.deskclock";
|
||||
enqueueModelUpdateTask(
|
||||
|
||||
@@ -164,7 +164,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
|
||||
@Override
|
||||
public Cursor query(Uri uri, String[] projection, String selection,
|
||||
String[] selectionArgs, String sortOrder) {
|
||||
String[] selectionArgs, String sortOrder) {
|
||||
createDbIfNotExists();
|
||||
|
||||
SqlArguments args = new SqlArguments(uri, selection, selectionArgs);
|
||||
@@ -245,7 +245,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
AppWidgetHost widgetHost = mOpenHelper.newLauncherWidgetHost();
|
||||
int appWidgetId = widgetHost.allocateAppWidgetId();
|
||||
values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId);
|
||||
if (!appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,cn)) {
|
||||
if (!appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, cn)) {
|
||||
widgetHost.deleteAppWidgetId(appWidgetId);
|
||||
return false;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
clearFlagEmptyDbCreated();
|
||||
return null;
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_WAS_EMPTY_DB_CREATED : {
|
||||
case LauncherSettings.Settings.METHOD_WAS_EMPTY_DB_CREATED: {
|
||||
Bundle result = new Bundle();
|
||||
result.putBoolean(LauncherSettings.Settings.EXTRA_VALUE,
|
||||
Utilities.getPrefs(getContext()).getBoolean(EMPTY_DATABASE_CREATED, false));
|
||||
@@ -381,6 +381,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB: {
|
||||
mOpenHelper.createEmptyDB(mOpenHelper.getWritableDatabase());
|
||||
// sanitizeDuplicateItems(mOpenHelper.getWritableDatabase());
|
||||
return null;
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_LOAD_DEFAULT_FAVORITES: {
|
||||
@@ -406,8 +407,29 @@ public class LauncherProvider extends ContentProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sanitizeDuplicateItems(SQLiteDatabase db) {
|
||||
db.beginTransaction();
|
||||
try {
|
||||
// 查出桌面上所有应用的 intent, screen, cellX, cellY 以及 id
|
||||
// 编写 SQL 删除那些 intent 相同、且 ID 较大的重复行
|
||||
String deleteQuery = "DELETE FROM favorites WHERE id NOT IN (" +
|
||||
"SELECT MIN(id) FROM favorites " +
|
||||
"WHERE itemType = 0 " + // ITEM_TYPE_APPLICATION
|
||||
"GROUP BY intent, container, screen, cellX, cellY" +
|
||||
") AND container = -100"; // -100 代表桌面 WORKSPACE
|
||||
|
||||
db.execSQL(deleteQuery);
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Exception e) {
|
||||
Log.e("LauncherProvider", "Failed to sanitize duplicates", e);
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes any empty folder from the DB.
|
||||
*
|
||||
* @return Ids of deleted folders.
|
||||
*/
|
||||
private IntArray deleteEmptyFolders() {
|
||||
@@ -416,9 +438,9 @@ public class LauncherProvider extends ContentProvider {
|
||||
// Select folders whose id do not match any container value.
|
||||
String selection = LauncherSettings.Favorites.ITEM_TYPE + " = "
|
||||
+ LauncherSettings.Favorites.ITEM_TYPE_FOLDER + " AND "
|
||||
+ LauncherSettings.Favorites._ID + " NOT IN (SELECT " +
|
||||
LauncherSettings.Favorites.CONTAINER + " FROM "
|
||||
+ Favorites.TABLE_NAME + ")";
|
||||
+ LauncherSettings.Favorites._ID + " NOT IN (SELECT " +
|
||||
LauncherSettings.Favorites.CONTAINER + " FROM "
|
||||
+ Favorites.TABLE_NAME + ")";
|
||||
|
||||
IntArray folderIds = LauncherDbUtils.queryIntArray(db, Favorites.TABLE_NAME,
|
||||
Favorites._ID, selection, null, null);
|
||||
@@ -441,7 +463,8 @@ public class LauncherProvider extends ContentProvider {
|
||||
mListenerHandler.sendEmptyMessage(ChangeListenerWrapper.MSG_LAUNCHER_PROVIDER_CHANGED);
|
||||
}
|
||||
|
||||
@Thunk static void addModifiedTime(ContentValues values) {
|
||||
@Thunk
|
||||
static void addModifiedTime(ContentValues values) {
|
||||
values.put(LauncherSettings.Favorites.MODIFIED, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@@ -451,10 +474,10 @@ public class LauncherProvider extends ContentProvider {
|
||||
|
||||
/**
|
||||
* Loads the default workspace based on the following priority scheme:
|
||||
* 1) From the app restrictions
|
||||
* 2) From a package provided by play store
|
||||
* 3) From a partner configuration APK, already in the system image
|
||||
* 4) The default configuration for the particular device
|
||||
* 1) From the app restrictions
|
||||
* 2) From a package provided by play store
|
||||
* 3) From a partner configuration APK, already in the system image
|
||||
* 4) The default configuration for the particular device
|
||||
*/
|
||||
synchronized private void loadDefaultFavoritesIfNecessary() {
|
||||
SharedPreferences sp = Utilities.getPrefs(getContext());
|
||||
@@ -465,7 +488,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
AppWidgetHost widgetHost = mOpenHelper.newLauncherWidgetHost();
|
||||
AutoInstallsLayout loader = createWorkspaceLoaderFromAppRestriction(widgetHost);
|
||||
if (loader == null) {
|
||||
loader = AutoInstallsLayout.get(getContext(),widgetHost, mOpenHelper);
|
||||
loader = AutoInstallsLayout.get(getContext(), widgetHost, mOpenHelper);
|
||||
}
|
||||
if (loader == null) {
|
||||
final Partner partner = Partner.get(getContext().getPackageManager());
|
||||
@@ -538,7 +561,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
ctx.getPackageManager().getResourcesForApplication(pi.applicationInfo),
|
||||
() -> parser, AutoInstallsLayout.TAG_WORKSPACE);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error getting layout stream from: " + authority , e);
|
||||
Log.e(TAG, "Error getting layout stream from: " + authority, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -843,11 +866,12 @@ public class LauncherProvider extends ContentProvider {
|
||||
* Replaces all shortcuts of type {@link Favorites#ITEM_TYPE_SHORTCUT} which have a valid
|
||||
* launcher activity target with {@link Favorites#ITEM_TYPE_APPLICATION}.
|
||||
*/
|
||||
@Thunk void convertShortcutsToLauncherActivities(SQLiteDatabase db) {
|
||||
@Thunk
|
||||
void convertShortcutsToLauncherActivities(SQLiteDatabase db) {
|
||||
try (LauncherDbUtils.SQLiteTransaction t = new LauncherDbUtils.SQLiteTransaction(db);
|
||||
// Only consider the primary user as other users can't have a shortcut.
|
||||
Cursor c = db.query(Favorites.TABLE_NAME,
|
||||
new String[] { Favorites._ID, Favorites.INTENT},
|
||||
new String[]{Favorites._ID, Favorites.INTENT},
|
||||
"itemType=" + Favorites.ITEM_TYPE_SHORTCUT +
|
||||
" AND profileId=" + getDefaultUserSerial(),
|
||||
null, null, null, null);
|
||||
@@ -881,7 +905,8 @@ public class LauncherProvider extends ContentProvider {
|
||||
}
|
||||
}
|
||||
|
||||
@Thunk boolean updateFolderItemsRank(SQLiteDatabase db, boolean addRankColumn) {
|
||||
@Thunk
|
||||
boolean updateFolderItemsRank(SQLiteDatabase db, boolean addRankColumn) {
|
||||
try (LauncherDbUtils.SQLiteTransaction t = new LauncherDbUtils.SQLiteTransaction(db)) {
|
||||
if (addRankColumn) {
|
||||
// Insert new column for holding rank
|
||||
@@ -890,14 +915,14 @@ public class LauncherProvider extends ContentProvider {
|
||||
|
||||
// Get a map for folder ID to folder width
|
||||
Cursor c = db.rawQuery("SELECT container, MAX(cellX) FROM favorites"
|
||||
+ " WHERE container IN (SELECT _id FROM favorites WHERE itemType = ?)"
|
||||
+ " GROUP BY container;",
|
||||
new String[] {Integer.toString(LauncherSettings.Favorites.ITEM_TYPE_FOLDER)});
|
||||
+ " WHERE container IN (SELECT _id FROM favorites WHERE itemType = ?)"
|
||||
+ " GROUP BY container;",
|
||||
new String[]{Integer.toString(LauncherSettings.Favorites.ITEM_TYPE_FOLDER)});
|
||||
|
||||
while (c.moveToNext()) {
|
||||
db.execSQL("UPDATE favorites SET rank=cellX+(cellY*?) WHERE "
|
||||
+ "container=? AND cellX IS NOT NULL AND cellY IS NOT NULL;",
|
||||
new Object[] {c.getLong(1) + 1, c.getLong(0)});
|
||||
+ "container=? AND cellX IS NOT NULL AND cellY IS NOT NULL;",
|
||||
new Object[]{c.getLong(1) + 1, c.getLong(0)});
|
||||
}
|
||||
|
||||
c.close();
|
||||
@@ -980,7 +1005,8 @@ public class LauncherProvider extends ContentProvider {
|
||||
Favorites.CONTAINER_DESKTOP);
|
||||
}
|
||||
|
||||
@Thunk int loadFavorites(SQLiteDatabase db, AutoInstallsLayout loader) {
|
||||
@Thunk
|
||||
int loadFavorites(SQLiteDatabase db, AutoInstallsLayout loader) {
|
||||
// TODO: Use multiple loaders with fall-back and transaction.
|
||||
int count = loader.loadLayout(db, new IntArray());
|
||||
|
||||
@@ -994,7 +1020,8 @@ public class LauncherProvider extends ContentProvider {
|
||||
/**
|
||||
* @return the max _id in the provided table.
|
||||
*/
|
||||
@Thunk static int getMaxId(SQLiteDatabase db, String query, Object... args) {
|
||||
@Thunk
|
||||
static int getMaxId(SQLiteDatabase db, String query, Object... args) {
|
||||
int max = (int) DatabaseUtils.longForQuery(db,
|
||||
String.format(Locale.ENGLISH, query, args),
|
||||
null);
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.blankj.utilcode.util.ColorUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Created by haoge on 2017/3/2.
|
||||
*/
|
||||
|
||||
public class ToastUtil {
|
||||
private static final String TAG = ToastUtil.class.getSimpleName();
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context mContext;
|
||||
private static Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
private static Toast debugToast;
|
||||
private static Toast toast;
|
||||
|
||||
|
||||
@SuppressLint("ShowToast")
|
||||
public static void init(Context context) {
|
||||
mContext = context;
|
||||
toast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
|
||||
debugToast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
|
||||
|
||||
}
|
||||
|
||||
private static long time1 = 0L;
|
||||
private static long time2 = 0L;
|
||||
|
||||
public static void show(final String msg) {
|
||||
ToastUtils.make()
|
||||
// .setBgColor(ColorUtils.getColor(R.color.toast_color))
|
||||
.setTextColor(Color.DKGRAY)
|
||||
// .setGravity(Gravity.CENTER, 0, 0)
|
||||
.setNotUseSystemToast()
|
||||
.show(msg);
|
||||
}
|
||||
|
||||
public static void betaShow(final String msg) {
|
||||
if (JGYUtils.isBetaVersion() || BuildConfig.DEBUG) {
|
||||
ToastUtils.make()
|
||||
// .setBgColor(ColorUtils.getColor(R.color.toast_color))
|
||||
.setTextColor(Color.RED)
|
||||
// .setGravity(Gravity.CENTER, 0, 0)
|
||||
.setNotUseSystemToast()
|
||||
.setDurationIsLong(true)
|
||||
.show(msg);
|
||||
} else {
|
||||
Log.e(TAG, "debugShow: " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showCenter(final String msg) {
|
||||
ToastUtils.make()
|
||||
.setBgColor(ColorUtils.getColor(R.color.toast_color))
|
||||
.setTextColor(Color.WHITE)
|
||||
.setGravity(Gravity.CENTER, 0, 0)
|
||||
.setNotUseSystemToast()
|
||||
.show(msg);
|
||||
}
|
||||
|
||||
private static Toast mToast = null;
|
||||
|
||||
//android 8.0以后限制
|
||||
//https://www.jianshu.com/p/d9813ad03d59
|
||||
//https://www.jianshu.com/p/050ce052b873
|
||||
public static void showToast(Context context, String text, int duration) {
|
||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
|
||||
Toast.makeText(context, text, duration).show();
|
||||
} else {
|
||||
if (mToast == null) {
|
||||
mToast = Toast.makeText(context, text, duration);
|
||||
} else {
|
||||
mToast.setText(text);
|
||||
mToast.setDuration(duration);
|
||||
}
|
||||
mToast.show();
|
||||
}
|
||||
}
|
||||
|
||||
// public static void showInCenter(String msg) {
|
||||
// mainHandler.post(() -> {
|
||||
// if (toast != null) {
|
||||
// toast.setGravity(Gravity.CENTER, 0, 0);
|
||||
// toast.setText(msg);
|
||||
// toast.show();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
package com.aoleyun.os.TTUtils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.Build;
|
||||
import android.os.RemoteException;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
|
||||
public class Utils {
|
||||
private static String TAG = Utils.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* 获取设备序列号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SuppressLint({"MissingPermission", "NewApi"})
|
||||
public static String getSerial() {
|
||||
String serial = "unknow";
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
|
||||
serial = Build.getSerial();
|
||||
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
|
||||
serial = Build.SERIAL;
|
||||
} else {//8.0-
|
||||
Class<?> c = Class.forName("android.os.SystemProperties");
|
||||
Method get = c.getMethod("get", String.class);
|
||||
serial = (String) get.invoke(c, "ro.serialno");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("e", "读取设备序列号异常:" + e.toString());
|
||||
}
|
||||
return serial;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 清除所有最近记录
|
||||
*/
|
||||
public void removeAllTask(Context context) {
|
||||
List<ActivityManager.RecentTaskInfo> list = getRecentTasks(ActivityManager.getMaxRecentTasksStatic(), getCurrentUserId());
|
||||
|
||||
for (ActivityManager.RecentTaskInfo info : list) {
|
||||
if (info.realActivity != null) {
|
||||
Log.e(TAG, "removeAllTask: " + info.realActivity.getPackageName());
|
||||
//排除自身
|
||||
if (BuildConfig.APPLICATION_ID.equals(info.realActivity.getPackageName())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try {
|
||||
ActivityManagerNative.getDefault().removeTask(info.id);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "removeAllTask: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果界面正在最近任务列表,有些app可能不会被清理
|
||||
*/
|
||||
public static void removeTask(String packageName) {
|
||||
if (TextUtils.isEmpty(packageName)) return;
|
||||
List<ActivityManager.RecentTaskInfo> list = getRecentTasks(ActivityManager.getMaxRecentTasksStatic(), getCurrentUserId());
|
||||
HashMap<String, Integer> taskMap = new HashMap<>();
|
||||
for (ActivityManager.RecentTaskInfo info : list) {
|
||||
taskMap.put(info.realActivity.getPackageName(), info.id);
|
||||
}
|
||||
try {
|
||||
ActivityManagerNative.getDefault().removeTask(taskMap.get(packageName));
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "removeTask: " + e.getMessage());
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "removeTask: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a list of the recents tasks.
|
||||
* 获取近期任务列表
|
||||
*/
|
||||
public static List<ActivityManager.RecentTaskInfo> getRecentTasks(int numTasks, int userId) {
|
||||
try {
|
||||
return ActivityTaskManager.getService().getRecentTasks(numTasks,
|
||||
RECENT_IGNORE_UNAVAILABLE, userId).getList();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed to get recent tasks " + e);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current user's id.
|
||||
* 获取userId
|
||||
*/
|
||||
public static int getCurrentUserId() {
|
||||
UserInfo ui;
|
||||
try {
|
||||
ui = ActivityManager.getService().getCurrentUser();
|
||||
return ui != null ? ui.id : 0;
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.aoleyun.os.base;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.manager.ConnectManager;
|
||||
import com.aoleyun.os.network.NetInterfaceManager;
|
||||
import com.aoleyun.os.uiuiutils.JgyUtils;
|
||||
import com.aoleyun.os.uiuiutils.TimeUtils;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
public class BaseApplication extends Application {
|
||||
private static final String TAG = BaseApplication.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
String rootDir = MMKV.initialize(this);
|
||||
Log.e(TAG, "onCreate: " + rootDir);
|
||||
|
||||
CrashReport.initCrashReport(getApplicationContext(), "6c94f946fe", false);
|
||||
CrashReport.setDeviceModel(this, Build.MODEL);
|
||||
CrashReport.setDeviceId(this, Utils.getSerial(this));
|
||||
|
||||
JgyUtils.init(this);
|
||||
TimeUtils.init(this);
|
||||
Aria.init(this);
|
||||
NetInterfaceManager.init(this);
|
||||
// 初始化 Toast 框架
|
||||
Toaster.init(this);
|
||||
ConnectManager.init(this);
|
||||
}
|
||||
}
|
||||
@@ -1,365 +0,0 @@
|
||||
package com.aoleyun.os.base;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
import com.aoleyun.os.TTUtils.ToastUtil;
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.jpush.TagAliasOperatorHelper;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetWorkManager;
|
||||
import com.aoleyun.os.network.URLPath;
|
||||
import com.aoleyun.os.uiuiutils.JGYUtils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import cn.jpush.android.api.JPushMessage;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class MyApplication extends Application {
|
||||
private static final String TAG = MyApplication.class.getSimpleName();
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static MyApplication app;
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context context;
|
||||
|
||||
public static MyApplication getInstance() {
|
||||
return app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
app = this;
|
||||
context = this;
|
||||
String rootDir = MMKV.initialize(this);
|
||||
Log.e(TAG, "onCreate: " + rootDir);
|
||||
JGYUtils.init(this);
|
||||
Aria.init(this);
|
||||
NetWorkManager.init(this);
|
||||
ToastUtil.init(this);
|
||||
|
||||
initJPush();
|
||||
}
|
||||
|
||||
private void initJPush() {
|
||||
JPushInterface.setDebugMode(BuildConfig.DEBUG); // 设置开启日志,发布时请关闭日志
|
||||
JPushInterface.init(this);
|
||||
initAliasObservable();
|
||||
initTagObservable();
|
||||
setJpushAlias();
|
||||
setJpushTags();
|
||||
}
|
||||
|
||||
private String appPackageName;
|
||||
private long runTime = 0;
|
||||
private long onClickTime = 0;
|
||||
|
||||
public void setOnClickTime(long time) {
|
||||
this.onClickTime = time;
|
||||
}
|
||||
|
||||
public long getOnClickTime() {
|
||||
return onClickTime;
|
||||
}
|
||||
|
||||
public void setAppPackageName(String name) {
|
||||
this.appPackageName = name;
|
||||
}
|
||||
|
||||
public String getAppPackageName() {
|
||||
return appPackageName;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
this.runTime = time;
|
||||
}
|
||||
|
||||
public long getRunTime() {
|
||||
return runTime;
|
||||
}
|
||||
|
||||
|
||||
private void initAliasObservable() {
|
||||
Log.e(TAG, "initAliasObservable: ");
|
||||
Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
|
||||
onAliasResult = new OnAliasResult() {
|
||||
@Override
|
||||
public void onResult(int code) {
|
||||
Log.e("initAliasObservable", "onResult: " + code);
|
||||
emitter.onNext(code);
|
||||
}
|
||||
};
|
||||
}
|
||||
}).throttleLast(1, TimeUnit.HOURS)
|
||||
.subscribe(new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer integer) {
|
||||
Log.e("initAliasObservable", "onNext: " + integer);
|
||||
String s = "alias:\t";
|
||||
switch (integer) {
|
||||
case 0:
|
||||
Log.e("jiguangInterface", s + "Alias绑定成功");
|
||||
break;
|
||||
case 6001:
|
||||
Log.e("jiguangInterface", s + "无效的设置");
|
||||
break;
|
||||
case 6011:
|
||||
Log.e("jiguangInterface", s + "短时间内操作过于频繁");
|
||||
break;
|
||||
case 6013:
|
||||
Log.e("jiguangInterface", s + "用户设备时间轴异常");
|
||||
ToastUtil.show("用户设备时间轴异常,修改后重新登陆\t" + s + "code:6013");
|
||||
break;
|
||||
case 6022:
|
||||
Log.e("jiguangInterface", s + "alias 操作正在进行中");
|
||||
break;
|
||||
//需要重新设置
|
||||
case 6002:
|
||||
Log.e("jiguangInterface", s + "设置超时,请重试");
|
||||
setJpushAlias();
|
||||
break;
|
||||
case 6014:
|
||||
Log.e("jiguangInterface", s + "服务器繁忙,建议重试");
|
||||
setJpushAlias();
|
||||
break;
|
||||
case 6020:
|
||||
Log.e("jiguangInterface", s + "建议过一段时间再设置");
|
||||
setJpushAlias();
|
||||
break;
|
||||
case 6024:
|
||||
Log.e("jiguangInterface", s + "服务器内部错误");
|
||||
setJpushAlias();
|
||||
break;
|
||||
case 6017:
|
||||
case 6027:
|
||||
Log.e("jiguangInterface", s + "别名绑定的设备数超过限制");
|
||||
cleanJpushAlias();
|
||||
setJpushAlias();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onAliasOperatorResult(JPushMessage jPushMessage) {
|
||||
if (jPushMessage == null) {
|
||||
return;
|
||||
}
|
||||
int errorCode = jPushMessage.getErrorCode();
|
||||
onAliasResult.onResult(errorCode);
|
||||
}
|
||||
|
||||
public static void setJpushAlias() {
|
||||
Log.e("jiguangInterface", "30s后重新设置alias");
|
||||
JPushInterface.setAlias(context, TagAliasOperatorHelper.sequence++, Utils.getSerial());
|
||||
}
|
||||
|
||||
private void initTagObservable() {
|
||||
Log.e(TAG, "initTagObservable: ");
|
||||
Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> emitter) {
|
||||
onTagResult = new OnTagResult() {
|
||||
@Override
|
||||
public void onResult(int code) {
|
||||
Log.e("initTagObservable", "onResult: " + code);
|
||||
emitter.onNext(code);
|
||||
}
|
||||
};
|
||||
}
|
||||
}).throttleLast(1, TimeUnit.HOURS)
|
||||
.subscribe(new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer integer) {
|
||||
Log.e("initTagObservable", "onNext: " + integer);
|
||||
String s = "tags:\t";
|
||||
switch (integer) {
|
||||
case 0:
|
||||
Log.e("jiguangInterface", s + "Tag绑定成功");
|
||||
break;
|
||||
case 6001:
|
||||
Log.e("jiguangInterface", s + "无效的设置");
|
||||
break;
|
||||
case 6005:
|
||||
Log.e("jiguangInterface", s + "某一个 tag 字符串不合法");
|
||||
ToastUtil.show("设备标签不合法,联系管理员修改\t" + "code:6005");
|
||||
break;
|
||||
case 6006:
|
||||
Log.e("jiguangInterface", s + "某一个 tag 超长");
|
||||
ToastUtil.show("设备标签过长,联系管理员修改\t" + "code:6006");
|
||||
break;
|
||||
case 6007:
|
||||
Log.e("jiguangInterface", s + "tags 数量超出限制");
|
||||
ToastUtil.show("设备标签数量超出限制,联系管理员修改\t" + "code:6007");
|
||||
break;
|
||||
case 6008:
|
||||
Log.e("jiguangInterface", s + "tag 超出总长度限制");
|
||||
ToastUtil.show("设备标签超出总长度限制,联系管理员修改\t" + "code:6008");
|
||||
break;
|
||||
case 6011:
|
||||
Log.e("jiguangInterface", s + "短时间内操作过于频繁");
|
||||
break;
|
||||
case 6013:
|
||||
Log.e("jiguangInterface", s + "用户设备时间轴异常");
|
||||
ToastUtil.show("用户设备时间轴异常,修改后重新登陆\t" + "code:6013");
|
||||
break;
|
||||
case 6018:
|
||||
Log.e("jiguangInterface", s + "Tags 过多");
|
||||
cleanJpushTag();
|
||||
ToastUtil.show("设备标签数量超出限制,联系管理员修改\t" + "code:6018");
|
||||
break;
|
||||
case 6021:
|
||||
Log.e("jiguangInterface", s + "tags 操作正在进行中");
|
||||
break;
|
||||
//需要重新设置
|
||||
case 6002:
|
||||
Log.e("jiguangInterface", s + "设置超时,请重试");
|
||||
setJpushTags();
|
||||
break;
|
||||
case 6014:
|
||||
Log.e("jiguangInterface", s + "服务器繁忙,建议重试");
|
||||
setJpushTags();
|
||||
break;
|
||||
case 6020:
|
||||
Log.e("jiguangInterface", s + "建议过一段时间再设置");
|
||||
setJpushTags();
|
||||
break;
|
||||
case 6024:
|
||||
Log.e("jiguangInterface", s + "服务器内部错误");
|
||||
setJpushTags();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onTagOperatorResult(JPushMessage jPushMessage) {
|
||||
if (jPushMessage == null) {
|
||||
return;
|
||||
}
|
||||
int errorCode = jPushMessage.getErrorCode();
|
||||
onTagResult.onResult(errorCode);
|
||||
}
|
||||
|
||||
public static void setJpushTags() {
|
||||
Log.e("jiguangInterface", "30s后重新设置tags");
|
||||
HTTPInterface.setJpushTags(context);
|
||||
}
|
||||
|
||||
private static OnAliasResult onAliasResult;
|
||||
|
||||
interface OnAliasResult {
|
||||
void onResult(int code);
|
||||
}
|
||||
|
||||
private static OnTagResult onTagResult;
|
||||
|
||||
interface OnTagResult {
|
||||
void onResult(int code);
|
||||
}
|
||||
|
||||
private String key = "MGM3YmE1YTE2MjJkYmE3OGQ1YmQwMGNjOjFjOTJiODVjZjM0ODhiNTJkNDQyNDJlOA==";
|
||||
|
||||
synchronized public void cleanJpushAlias() {
|
||||
//alias的绑定的设备超过10个,但是alias应该是一个设备对应一个,在重置设备后jpush的regid会变动,所以需要清除
|
||||
//https://docs.jiguang.cn/jpush/server/push/rest_api_v3_device/#_5
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder()
|
||||
.url(URLPath.DELETE_JPUSH_ALIAS + Utils.getSerial())
|
||||
.header("Authorization", key)
|
||||
.delete()
|
||||
.build();
|
||||
Call call = client.newCall(request);
|
||||
call.enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||
Log.e("cleanJpushAlias", "onFailure: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
|
||||
Log.e("cleanJpushAlias", "onResponse: " + response.toString());
|
||||
Log.e(TAG, "onResponse: " + "清除Alias成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
synchronized public void cleanJpushTag() {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder()
|
||||
.url(URLPath.DELETE_JPUSH_TAG + Utils.getSerial())
|
||||
.header("Authorization", key)
|
||||
.delete()
|
||||
.build();
|
||||
Call call = client.newCall(request);
|
||||
call.enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||
Log.e("cleanJpushTag", "onFailure: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
|
||||
Log.e("cleanJpushTag", "onResponse: " + response.toString());
|
||||
Log.e(TAG, "onResponse: " + "清除Tag成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.aoleyun.os.comm;
|
||||
|
||||
public class CommonConfig {
|
||||
public static final String MMKV_ID = "InterProcessKV";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.aoleyun.os.comm;
|
||||
|
||||
public class JGYActions {
|
||||
|
||||
/*锁定解锁设备 后台1是锁定,底层0是锁定*/
|
||||
public final static String ACTION_QCH_UNLOCK_IPAD = "qch_unlock_ipad";
|
||||
/*后台锁定*/
|
||||
public final static int NET_CODE_LOCKED = 1;
|
||||
/*后台解锁*/
|
||||
public final static int NET_CODE_UNLOCKED = 0;
|
||||
/*底层锁定*/
|
||||
public final static int FRAME_CODE_LOCKED = 0;
|
||||
/*底层解锁*/
|
||||
public final static int FRAME_CODE_UNLOCKED = 1;
|
||||
|
||||
/*
|
||||
* 需要写到底层的数据
|
||||
* */
|
||||
|
||||
/*应用管理-允许联网*/
|
||||
public final static String ACTION_HRRECEIVER_JGY = "qch_jgy_network_allow";
|
||||
/*应用管理-禁止联网*/
|
||||
public final static String ACTION_HRRECEIVER_JGY_DIS = "qch_jgy_network_disallow";
|
||||
/*状态栏*/
|
||||
public final static String ACTION_STATUSBAR_STATUS = "jgy_statusbar_status";
|
||||
|
||||
|
||||
/*
|
||||
* 应用内部的数据
|
||||
* */
|
||||
|
||||
//后台上传所有应用包名 将添加到桌面
|
||||
// TODO: 2021/10/13
|
||||
public final static String ACTION_JGY_SHORTCUTLIST = "only_jgy_shortcut_list";
|
||||
}
|
||||
@@ -0,0 +1,462 @@
|
||||
package com.aoleyun.os.disklrucache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.comm.CommonConfig;
|
||||
import com.jakewharton.disklrucache.DiskLruCache;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 磁盘缓存帮助类
|
||||
*/
|
||||
public class CacheHelper {
|
||||
private static final String TAG = "DiskLruCacheHelper";
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
private static final String DIR_NAME = "diskCache";
|
||||
private static final int MAX_COUNT = 5 * 1024 * 1024;
|
||||
private static final int DEFAULT_APP_VERSION = 1;
|
||||
|
||||
private DiskLruCache mDiskLruCache;
|
||||
|
||||
public CacheHelper(Context context) {
|
||||
mDiskLruCache = generateCache(context, DIR_NAME, MAX_COUNT);
|
||||
}
|
||||
|
||||
public CacheHelper(Context context, String dirName) {
|
||||
mDiskLruCache = generateCache(context, dirName, MAX_COUNT);
|
||||
}
|
||||
|
||||
public CacheHelper(Context context, String dirName, int maxCount) {
|
||||
mDiskLruCache = generateCache(context, dirName, maxCount);
|
||||
}
|
||||
|
||||
//custom cache dir
|
||||
public CacheHelper(File dir) {
|
||||
mDiskLruCache = generateCache(null, dir, MAX_COUNT);
|
||||
}
|
||||
|
||||
public CacheHelper(Context context, File dir) {
|
||||
mDiskLruCache = generateCache(context, dir, MAX_COUNT);
|
||||
}
|
||||
|
||||
public CacheHelper(Context context, File dir, int maxCount) {
|
||||
mDiskLruCache = generateCache(context, dir, maxCount);
|
||||
}
|
||||
|
||||
private DiskLruCache generateCache(Context context, File dir, int maxCount) {
|
||||
if (!dir.exists() || !dir.isDirectory()) {
|
||||
throw new IllegalArgumentException(
|
||||
dir + " is not a directory or does not exists. ");
|
||||
}
|
||||
|
||||
int appVersion = context == null ? DEFAULT_APP_VERSION : Utils.getAppVersion(context);
|
||||
|
||||
DiskLruCache diskLruCache = null;
|
||||
try {
|
||||
diskLruCache = DiskLruCache.open(
|
||||
dir,
|
||||
appVersion,
|
||||
DEFAULT_APP_VERSION,
|
||||
maxCount);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return diskLruCache;
|
||||
}
|
||||
|
||||
private DiskLruCache generateCache(Context context, String dirName, int maxCount) {
|
||||
DiskLruCache diskLruCache = null;
|
||||
try {
|
||||
diskLruCache = DiskLruCache.open(
|
||||
getDiskCacheDir(context, dirName),
|
||||
Utils.getAppVersion(context),
|
||||
DEFAULT_APP_VERSION,
|
||||
maxCount);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return diskLruCache;
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============== String 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
public void put(String key, String value) {
|
||||
Log.e(TAG, "put: " + key);
|
||||
mMMKV.encode(key, System.currentTimeMillis());
|
||||
|
||||
DiskLruCache.Editor edit = null;
|
||||
BufferedWriter bw = null;
|
||||
try {
|
||||
edit = editor(key);
|
||||
if (edit == null) {
|
||||
return;
|
||||
}
|
||||
OutputStream os = edit.newOutputStream(0);
|
||||
bw = new BufferedWriter(new OutputStreamWriter(os));
|
||||
bw.write(value);
|
||||
edit.commit();//write CLEAN
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
//s
|
||||
edit.abort();//write REMOVE
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (bw != null) {
|
||||
bw.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getAsString(String key) {
|
||||
Log.e(TAG, "getAsString: " + key);
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
//write READ
|
||||
inputStream = get(key);
|
||||
if (inputStream == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len = 0;
|
||||
byte[] buf = new byte[128];
|
||||
while ((len = inputStream.read(buf)) != -1) {
|
||||
sb.append(new String(buf, 0, len));
|
||||
}
|
||||
return sb.toString();
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void put(String key, JSONObject jsonObject) {
|
||||
put(key, jsonObject.toString());
|
||||
}
|
||||
|
||||
public JSONObject getAsJson(String key) {
|
||||
String val = getAsString(key);
|
||||
try {
|
||||
if (val != null) {
|
||||
return new JSONObject(val);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============ JSONArray 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
public void put(String key, JSONArray jsonArray) {
|
||||
put(key, jsonArray.toString());
|
||||
}
|
||||
|
||||
public JSONArray getAsJSONArray(String key) {
|
||||
String JSONString = getAsString(key);
|
||||
try {
|
||||
JSONArray obj = new JSONArray(JSONString);
|
||||
return obj;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============== byte 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
/**
|
||||
* 保存 byte数据 到 缓存中
|
||||
*
|
||||
* @param key 保存的key
|
||||
* @param value 保存的数据
|
||||
*/
|
||||
public void put(String key, byte[] value) {
|
||||
OutputStream out = null;
|
||||
DiskLruCache.Editor editor = null;
|
||||
try {
|
||||
editor = editor(key);
|
||||
if (editor == null) {
|
||||
return;
|
||||
}
|
||||
out = editor.newOutputStream(0);
|
||||
out.write(value);
|
||||
out.flush();
|
||||
editor.commit();//write CLEAN
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
editor.abort();//write REMOVE
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public byte[] getAsBytes(String key) {
|
||||
byte[] res = null;
|
||||
InputStream is = get(key);
|
||||
if (is == null) {
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
byte[] buf = new byte[256];
|
||||
int len = 0;
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
baos.write(buf, 0, len);
|
||||
}
|
||||
res = baos.toByteArray();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// =======================================
|
||||
// ============== 序列化 数据 读写 =============
|
||||
// =======================================
|
||||
public void put(String key, Serializable value) {
|
||||
DiskLruCache.Editor editor = editor(key);
|
||||
ObjectOutputStream oos = null;
|
||||
if (editor == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
OutputStream os = editor.newOutputStream(0);
|
||||
oos = new ObjectOutputStream(os);
|
||||
oos.writeObject(value);
|
||||
oos.flush();
|
||||
editor.commit();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
editor.abort();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (oos != null) {
|
||||
oos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public <T> T getAsSerializable(String key) {
|
||||
T t = null;
|
||||
InputStream is = get(key);
|
||||
ObjectInputStream ois = null;
|
||||
if (is == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
ois = new ObjectInputStream(is);
|
||||
t = (T) ois.readObject();
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (ois != null) {
|
||||
ois.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============== bitmap 数据 读写 =============
|
||||
// =======================================
|
||||
public void put(String key, Bitmap bitmap) {
|
||||
put(key, Utils.bitmap2Bytes(bitmap));
|
||||
}
|
||||
|
||||
public Bitmap getAsBitmap(String key) {
|
||||
byte[] bytes = getAsBytes(key);
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
return Utils.bytes2Bitmap(bytes);
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============= drawable 数据 读写 =============
|
||||
// =======================================
|
||||
public void put(String key, Drawable value) {
|
||||
put(key, Utils.drawable2Bitmap(value));
|
||||
}
|
||||
|
||||
public Drawable getAsDrawable(String key) {
|
||||
byte[] bytes = getAsBytes(key);
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
return Utils.bitmap2Drawable(Utils.bytes2Bitmap(bytes));
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============= other methods =============
|
||||
// =======================================
|
||||
public boolean remove(String key) {
|
||||
try {
|
||||
key = Utils.hashKeyForDisk(key);
|
||||
return mDiskLruCache.remove(key);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
mDiskLruCache.close();
|
||||
}
|
||||
|
||||
public void delete() throws IOException {
|
||||
mDiskLruCache.delete();
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
mDiskLruCache.flush();
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
return mDiskLruCache.isClosed();
|
||||
}
|
||||
|
||||
public long size() {
|
||||
return mDiskLruCache.size();
|
||||
}
|
||||
|
||||
public void setMaxSize(long maxSize) {
|
||||
mDiskLruCache.setMaxSize(maxSize);
|
||||
}
|
||||
|
||||
public File getDirectory() {
|
||||
return mDiskLruCache.getDirectory();
|
||||
}
|
||||
|
||||
public long getMaxSize() {
|
||||
return mDiskLruCache.getMaxSize();
|
||||
}
|
||||
|
||||
|
||||
// =======================================
|
||||
// ===遇到文件比较大的,可以直接通过流读写 =====
|
||||
// =======================================
|
||||
//basic editor
|
||||
public DiskLruCache.Editor editor(String key) {
|
||||
try {
|
||||
key = Utils.hashKeyForDisk(key);
|
||||
//wirte DIRTY
|
||||
DiskLruCache.Editor edit = mDiskLruCache.edit(key);
|
||||
//edit maybe null :the entry is editing
|
||||
if (edit == null) {
|
||||
Log.w(TAG, "the entry spcified key:" + key + " is editing by other . ");
|
||||
}
|
||||
return edit;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//basic get
|
||||
public InputStream get(String key) {
|
||||
try {
|
||||
DiskLruCache.Snapshot snapshot = mDiskLruCache.get(Utils.hashKeyForDisk(key));
|
||||
if (snapshot == null) //not find entry , or entry.readable = false
|
||||
{
|
||||
Log.e(TAG, "not find entry , or entry.readable = false");
|
||||
return null;
|
||||
}
|
||||
//write READ
|
||||
return snapshot.getInputStream(0);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// =======================================
|
||||
// ============== 序列化 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
private File getDiskCacheDir(Context context, String uniqueName) {
|
||||
String cachePath;
|
||||
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|
||||
|| !Environment.isExternalStorageRemovable()) {
|
||||
cachePath = context.getExternalCacheDir().getPath();
|
||||
} else {
|
||||
cachePath = context.getCacheDir().getPath();
|
||||
}
|
||||
return new File(cachePath + File.separator + uniqueName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,427 @@
|
||||
package com.aoleyun.os.disklrucache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import com.jakewharton.disklrucache.DiskLruCache;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 磁盘缓存帮助类
|
||||
*/
|
||||
public class DiskLruCacheHelper {
|
||||
private static final String DIR_NAME = "diskCache";
|
||||
private static final int MAX_COUNT = 5 * 1024 * 1024;
|
||||
private static final int DEFAULT_APP_VERSION = 1;
|
||||
|
||||
private static final String TAG = "DiskLruCacheHelper";
|
||||
|
||||
private DiskLruCache mDiskLruCache;
|
||||
|
||||
public DiskLruCacheHelper(Context context) throws IOException {
|
||||
mDiskLruCache = generateCache(context, DIR_NAME, MAX_COUNT);
|
||||
}
|
||||
|
||||
public DiskLruCacheHelper(Context context, String dirName) throws IOException {
|
||||
mDiskLruCache = generateCache(context, dirName, MAX_COUNT);
|
||||
}
|
||||
|
||||
public DiskLruCacheHelper(Context context, String dirName, int maxCount) throws IOException {
|
||||
mDiskLruCache = generateCache(context, dirName, maxCount);
|
||||
}
|
||||
|
||||
//custom cache dir
|
||||
public DiskLruCacheHelper(File dir) throws IOException {
|
||||
mDiskLruCache = generateCache(null, dir, MAX_COUNT);
|
||||
}
|
||||
|
||||
public DiskLruCacheHelper(Context context, File dir) throws IOException {
|
||||
mDiskLruCache = generateCache(context, dir, MAX_COUNT);
|
||||
}
|
||||
|
||||
public DiskLruCacheHelper(Context context, File dir, int maxCount) throws IOException {
|
||||
mDiskLruCache = generateCache(context, dir, maxCount);
|
||||
}
|
||||
|
||||
private DiskLruCache generateCache(Context context, File dir, int maxCount) throws IOException {
|
||||
if (!dir.exists() || !dir.isDirectory()) {
|
||||
throw new IllegalArgumentException(
|
||||
dir + " is not a directory or does not exists. ");
|
||||
}
|
||||
|
||||
int appVersion = context == null ? DEFAULT_APP_VERSION : Utils.getAppVersion(context);
|
||||
|
||||
DiskLruCache diskLruCache = DiskLruCache.open(
|
||||
dir,
|
||||
appVersion,
|
||||
DEFAULT_APP_VERSION,
|
||||
maxCount);
|
||||
|
||||
return diskLruCache;
|
||||
}
|
||||
|
||||
private DiskLruCache generateCache(Context context, String dirName, int maxCount) throws IOException {
|
||||
DiskLruCache diskLruCache = DiskLruCache.open(
|
||||
getDiskCacheDir(context, dirName),
|
||||
Utils.getAppVersion(context),
|
||||
DEFAULT_APP_VERSION,
|
||||
maxCount);
|
||||
return diskLruCache;
|
||||
}
|
||||
// =======================================
|
||||
// ============== String 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
public void put(String key, String value) {
|
||||
DiskLruCache.Editor edit = null;
|
||||
BufferedWriter bw = null;
|
||||
try {
|
||||
edit = editor(key);
|
||||
if (edit == null) return;
|
||||
OutputStream os = edit.newOutputStream(0);
|
||||
bw = new BufferedWriter(new OutputStreamWriter(os));
|
||||
bw.write(value);
|
||||
edit.commit();//write CLEAN
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
//s
|
||||
edit.abort();//write REMOVE
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (bw != null)
|
||||
bw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getAsString(String key) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
//write READ
|
||||
inputStream = get(key);
|
||||
if (inputStream == null) return null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len = 0;
|
||||
byte[] buf = new byte[128];
|
||||
while ((len = inputStream.read(buf)) != -1) {
|
||||
sb.append(new String(buf, 0, len));
|
||||
}
|
||||
return sb.toString();
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (inputStream != null)
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void put(String key, JSONObject jsonObject) {
|
||||
put(key, jsonObject.toString());
|
||||
}
|
||||
|
||||
public JSONObject getAsJson(String key) {
|
||||
String val = getAsString(key);
|
||||
try {
|
||||
if (val != null)
|
||||
return new JSONObject(val);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============ JSONArray 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
public void put(String key, JSONArray jsonArray) {
|
||||
put(key, jsonArray.toString());
|
||||
}
|
||||
|
||||
public JSONArray getAsJSONArray(String key) {
|
||||
String JSONString = getAsString(key);
|
||||
try {
|
||||
JSONArray obj = new JSONArray(JSONString);
|
||||
return obj;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============== byte 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
/**
|
||||
* 保存 byte数据 到 缓存中
|
||||
*
|
||||
* @param key 保存的key
|
||||
* @param value 保存的数据
|
||||
*/
|
||||
public void put(String key, byte[] value) {
|
||||
OutputStream out = null;
|
||||
DiskLruCache.Editor editor = null;
|
||||
try {
|
||||
editor = editor(key);
|
||||
if (editor == null) {
|
||||
return;
|
||||
}
|
||||
out = editor.newOutputStream(0);
|
||||
out.write(value);
|
||||
out.flush();
|
||||
editor.commit();//write CLEAN
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
editor.abort();//write REMOVE
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public byte[] getAsBytes(String key) {
|
||||
byte[] res = null;
|
||||
InputStream is = get(key);
|
||||
if (is == null) return null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
byte[] buf = new byte[256];
|
||||
int len = 0;
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
baos.write(buf, 0, len);
|
||||
}
|
||||
res = baos.toByteArray();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// =======================================
|
||||
// ============== 序列化 数据 读写 =============
|
||||
// =======================================
|
||||
public void put(String key, Serializable value) {
|
||||
DiskLruCache.Editor editor = editor(key);
|
||||
ObjectOutputStream oos = null;
|
||||
if (editor == null) return;
|
||||
try {
|
||||
OutputStream os = editor.newOutputStream(0);
|
||||
oos = new ObjectOutputStream(os);
|
||||
oos.writeObject(value);
|
||||
oos.flush();
|
||||
editor.commit();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
editor.abort();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (oos != null)
|
||||
oos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public <T> T getAsSerializable(String key) {
|
||||
T t = null;
|
||||
InputStream is = get(key);
|
||||
ObjectInputStream ois = null;
|
||||
if (is == null) return null;
|
||||
try {
|
||||
ois = new ObjectInputStream(is);
|
||||
t = (T) ois.readObject();
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (ois != null)
|
||||
ois.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============== bitmap 数据 读写 =============
|
||||
// =======================================
|
||||
public void put(String key, Bitmap bitmap) {
|
||||
put(key, Utils.bitmap2Bytes(bitmap));
|
||||
}
|
||||
|
||||
public Bitmap getAsBitmap(String key) {
|
||||
byte[] bytes = getAsBytes(key);
|
||||
if (bytes == null) return null;
|
||||
return Utils.bytes2Bitmap(bytes);
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============= drawable 数据 读写 =============
|
||||
// =======================================
|
||||
public void put(String key, Drawable value) {
|
||||
put(key, Utils.drawable2Bitmap(value));
|
||||
}
|
||||
|
||||
public Drawable getAsDrawable(String key) {
|
||||
byte[] bytes = getAsBytes(key);
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
return Utils.bitmap2Drawable(Utils.bytes2Bitmap(bytes));
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// ============= other methods =============
|
||||
// =======================================
|
||||
public boolean remove(String key) {
|
||||
try {
|
||||
key = Utils.hashKeyForDisk(key);
|
||||
return mDiskLruCache.remove(key);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
mDiskLruCache.close();
|
||||
}
|
||||
|
||||
public void delete() throws IOException {
|
||||
mDiskLruCache.delete();
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
mDiskLruCache.flush();
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
return mDiskLruCache.isClosed();
|
||||
}
|
||||
|
||||
public long size() {
|
||||
return mDiskLruCache.size();
|
||||
}
|
||||
|
||||
public void setMaxSize(long maxSize) {
|
||||
mDiskLruCache.setMaxSize(maxSize);
|
||||
}
|
||||
|
||||
public File getDirectory() {
|
||||
return mDiskLruCache.getDirectory();
|
||||
}
|
||||
|
||||
public long getMaxSize() {
|
||||
return mDiskLruCache.getMaxSize();
|
||||
}
|
||||
|
||||
|
||||
// =======================================
|
||||
// ===遇到文件比较大的,可以直接通过流读写 =====
|
||||
// =======================================
|
||||
//basic editor
|
||||
public DiskLruCache.Editor editor(String key) {
|
||||
try {
|
||||
key = Utils.hashKeyForDisk(key);
|
||||
//wirte DIRTY
|
||||
DiskLruCache.Editor edit = mDiskLruCache.edit(key);
|
||||
//edit maybe null :the entry is editing
|
||||
if (edit == null) {
|
||||
Log.w(TAG, "the entry spcified key:" + key + " is editing by other . ");
|
||||
}
|
||||
return edit;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//basic get
|
||||
public InputStream get(String key) {
|
||||
try {
|
||||
DiskLruCache.Snapshot snapshot = mDiskLruCache.get(Utils.hashKeyForDisk(key));
|
||||
if (snapshot == null) //not find entry , or entry.readable = false
|
||||
{
|
||||
Log.e(TAG, "not find entry , or entry.readable = false");
|
||||
return null;
|
||||
}
|
||||
//write READ
|
||||
return snapshot.getInputStream(0);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// =======================================
|
||||
// ============== 序列化 数据 读写 =============
|
||||
// =======================================
|
||||
|
||||
private File getDiskCacheDir(Context context, String uniqueName) {
|
||||
String cachePath;
|
||||
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|
||||
|| !Environment.isExternalStorageRemovable()) {
|
||||
cachePath = context.getExternalCacheDir().getPath();
|
||||
} else {
|
||||
cachePath = context.getCacheDir().getPath();
|
||||
}
|
||||
return new File(cachePath + File.separator + uniqueName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.aoleyun.os.disklrucache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class Utils {
|
||||
public static int getAppVersion(Context context) {
|
||||
try {
|
||||
PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
return info.versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public static String hashKeyForDisk(String key) {
|
||||
String cacheKey;
|
||||
try {
|
||||
final MessageDigest mDigest = MessageDigest.getInstance("MD5");
|
||||
mDigest.update(key.getBytes());
|
||||
cacheKey = bytesToHexString(mDigest.digest());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
cacheKey = String.valueOf(key.hashCode());
|
||||
}
|
||||
return cacheKey;
|
||||
}
|
||||
|
||||
public static String bytesToHexString(byte[] bytes) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
String hex = Integer.toHexString(0xFF & bytes[i]);
|
||||
if (hex.length() == 1) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(hex);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static byte[] bitmap2Bytes(Bitmap bm) {
|
||||
if (bm == null) {
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
public static Bitmap bytes2Bitmap(byte[] bytes) {
|
||||
return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Drawable → Bitmap
|
||||
*/
|
||||
public static Bitmap drawable2Bitmap(Drawable drawable) {
|
||||
if (drawable == null) {
|
||||
return null;
|
||||
}
|
||||
// 取 drawable 的长宽
|
||||
int w = drawable.getIntrinsicWidth();
|
||||
int h = drawable.getIntrinsicHeight();
|
||||
// 取 drawable 的颜色格式
|
||||
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
|
||||
// 建立对应 bitmap
|
||||
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
|
||||
// 建立对应 bitmap 的画布
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, w, h);
|
||||
// 把 drawable 内容画到画布中
|
||||
drawable.draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitmap → Drawable
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Drawable bitmap2Drawable(Bitmap bm) {
|
||||
if (bm == null) {
|
||||
return null;
|
||||
}
|
||||
BitmapDrawable bd = new BitmapDrawable(bm);
|
||||
bd.setTargetDensity(bm.getDensity());
|
||||
return new BitmapDrawable(bm);
|
||||
}
|
||||
}
|
||||
@@ -479,6 +479,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
}
|
||||
return folderCount >= MIN_FOLDERS_FOR_HARDWARE_OPTIMIZATION;
|
||||
}
|
||||
|
||||
public Bitmap blur(Bitmap image) {
|
||||
int width = Math.round(image.getWidth() * 0.4f);
|
||||
int height = Math.round(image.getHeight() * 0.4f);
|
||||
@@ -528,15 +529,13 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Opens the user folder described by the specified tag. The opening of the folder
|
||||
* is animated relative to the specified View. If the View is null, no animation
|
||||
* is played.
|
||||
*/
|
||||
public void animateOpen() {
|
||||
Bitmap bm = blur(getWallpaperBg());
|
||||
// Bitmap bm = blur(getWallpaperBg());
|
||||
Folder openFolder = getOpen(mLauncher);
|
||||
if (openFolder != null && openFolder != this) {
|
||||
// Close any open folder before opening a folder.
|
||||
@@ -546,7 +545,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mIsOpen = true;
|
||||
|
||||
DragLayer dragLayer = mLauncher.getDragLayer();
|
||||
dragLayer.setBackground(new BitmapDrawable(bm));
|
||||
// dragLayer.setBackground(new BitmapDrawable(bm));
|
||||
// Just verify that the folder hasn't already been added to the DragLayer.
|
||||
// There was a one-off crash where the folder had a parent already.
|
||||
if (getParent() == null) {
|
||||
|
||||