1.6.0526 增加高通和G128T平台
This commit is contained in:
42
build.gradle
42
build.gradle
@@ -67,8 +67,8 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
|
||||
versionCode 192
|
||||
versionName "1.5.0926"
|
||||
versionCode 203
|
||||
versionName "1.6.0526"
|
||||
|
||||
ndk {
|
||||
//选择要添加的对应 cpu 类型的 .so 库。
|
||||
@@ -205,9 +205,47 @@ android {
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
G128T {
|
||||
storeFile file("keystore/HuaruianG128T.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "g128t"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
QualcommDebug.initWith(debug)
|
||||
QualcommDebug {
|
||||
buildConfigField "String", "platform", '"QualcommA"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.zhanRui
|
||||
}
|
||||
|
||||
QualcommRelease.initWith(release)
|
||||
QualcommRelease {
|
||||
buildConfigField "String", "platform", '"QualcommA"'
|
||||
signingConfig signingConfigs.zhanRui
|
||||
}
|
||||
|
||||
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"'
|
||||
|
||||
@@ -13,6 +13,10 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
QualcommDebug {}
|
||||
QualcommRelease {}
|
||||
G128TDebug {}
|
||||
G128TRelease {}
|
||||
QZ15Debug {}
|
||||
QZ15Release {}
|
||||
seewoDebug {}
|
||||
|
||||
BIN
keystore/HuaruianG128T.jks
Normal file
BIN
keystore/HuaruianG128T.jks
Normal file
Binary file not shown.
BIN
res/drawable-hdpi/wallpapers.jpg
Normal file
BIN
res/drawable-hdpi/wallpapers.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB |
@@ -1226,7 +1226,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
mUpdate.checkUpdate(System.currentTimeMillis());
|
||||
mPasswd.getPassword(System.currentTimeMillis());
|
||||
TimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
HTTPInterface.sendRunningApp(Launcher.this);
|
||||
NetInterfaceManager.getInstance().sendRunningApp(Launcher.this);
|
||||
JgyUtils.getInstance().wakeUpAppstore();
|
||||
JgyUtils.getInstance().wakeUpDeviceInfo();
|
||||
checkIsRest();
|
||||
@@ -1285,7 +1285,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
|
||||
@Override
|
||||
public void onNext(Long aLong) {
|
||||
Log.e("passwdObserver", "onNext: " + aLong);
|
||||
HTTPInterface.getAppPasswd();
|
||||
NetInterfaceManager.getInstance().getAppPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -232,10 +232,6 @@ public class IconCache extends BaseIconCache {
|
||||
}
|
||||
|
||||
private List<String> appClassNameList = new ArrayList<String>() {{
|
||||
this.add("com.aoleyun.appstore.activity.SplashActivity");//应用市场
|
||||
this.add("com.aoleyun.browser.BrowserActivity");//浏览器
|
||||
this.add("com.aoleyun.sn.activity.SplashActivity");//
|
||||
this.add("com.aoleyun.info.activity.main.MainActivity");//
|
||||
this.add("com.android.calculator2.Calculator");//计算器
|
||||
this.add("com.android.calendar.AllInOneActivity");//日历
|
||||
this.add("com.android.camera.CameraLauncher");//相机
|
||||
@@ -269,10 +265,6 @@ public class IconCache extends BaseIconCache {
|
||||
|
||||
}};
|
||||
private List<String> appIconList = new ArrayList<String>() {{
|
||||
this.add("com_android_appstore");
|
||||
this.add("com_android_browser");
|
||||
this.add("com_aoleyun_sn");
|
||||
this.add("com_aoleyun_info");
|
||||
this.add("com_android_calculator2");
|
||||
this.add("com_android_calendar");
|
||||
this.add("com_android_camera");
|
||||
|
||||
@@ -342,10 +342,10 @@ public class LoaderTask implements Runnable {
|
||||
this.add("com.android.calendar");
|
||||
this.add("com.android.contacts");
|
||||
this.add("com.android.dialer");
|
||||
this.add("com.android.gallery3d");
|
||||
// this.add("com.android.gallery3d");
|
||||
this.add("com.android.mms");
|
||||
this.add("com.android.music");
|
||||
this.add("com.android.documentsui");
|
||||
// this.add("com.android.documentsui");
|
||||
this.add("com.android.fmradio");
|
||||
this.add("com.android.inputmethod.latin");
|
||||
this.add("com.android.stk");
|
||||
|
||||
@@ -27,86 +27,6 @@ import io.reactivex.disposables.Disposable;
|
||||
public class HTTPInterface {
|
||||
private static final String TAG = HTTPInterface.class.getSimpleName();
|
||||
|
||||
public static void getAppPasswd() {
|
||||
NetInterfaceManager.getInstance().getAppPasswordObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AppPasswdBean>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getAppPasswd", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AppPasswdBean>> listBaseResponse) {
|
||||
Log.e("getAppPasswd", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppPasswdBean> beanList = listBaseResponse.data;
|
||||
String jsonString = JsonParser.parseString(new Gson().toJson(beanList)).getAsJsonArray().toString();
|
||||
MMKV.defaultMMKV().encode("ApplicationLock", jsonString);
|
||||
Log.e("getAppPasswd", "onNext: " + jsonString);
|
||||
} else {
|
||||
MMKV.defaultMMKV().encode("ApplicationLock", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAppPasswd", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppPasswd", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送正在运行的app信息
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void sendRunningApp(Context context) {
|
||||
String packageName = TimeUtils.getInstance().getAppPackageName();
|
||||
Log.e("SendRunningApp", "packageName: " + packageName);
|
||||
long time = TimeUtils.getInstance().getStartTime();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("app_package", packageName);
|
||||
jsonObject.addProperty("version_name", ApkUtils.getAPPVersionName(context, packageName));
|
||||
jsonObject.addProperty("run_time", time / 1000);
|
||||
jsonObject.addProperty("app_name", ApkUtils.getAppNameByPackage(context, packageName));
|
||||
jsonObject.addProperty("status", 1);
|
||||
String jsonString = jsonObject.toString();
|
||||
NetInterfaceManager.getInstance().getRunningAppObservable(jsonString)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("SendRunningApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("SendRunningApp", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendRunningApp", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SendRunningApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// private static void setTag(Context context, Set set) {
|
||||
// TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||
// tagAliasBean.action = ACTION_SET;
|
||||
// sequence++;
|
||||
// tagAliasBean.tags = set;
|
||||
// tagAliasBean.isAliasAction = false;
|
||||
// TagAliasOperatorHelper.getInstance().handleAction(context, sequence, tagAliasBean);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,13 @@ import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.Batch;
|
||||
import com.aoleyun.os.network.interceptor.RepeatRequestInterceptor;
|
||||
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.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.io.File;
|
||||
@@ -42,7 +47,7 @@ import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class NetInterfaceManager {
|
||||
private static final String TAG = NetInterfaceManager.class.getSimpleName();
|
||||
private static final String TAG = "NetInterfaceManager";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static NetInterfaceManager sInstance;
|
||||
@@ -244,7 +249,89 @@ public class NetInterfaceManager {
|
||||
});
|
||||
}
|
||||
|
||||
private void clearAndAppendTags(Set<String> tagSets) {
|
||||
private void clearAndAppendTags(Set<String> tagSets) {
|
||||
|
||||
}
|
||||
|
||||
public void getAppPasswd() {
|
||||
NetInterfaceManager.getInstance().getAppPasswordObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AppPasswdBean>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getAppPasswd", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AppPasswdBean>> listBaseResponse) {
|
||||
Log.e("getAppPasswd", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AppPasswdBean> beanList = listBaseResponse.data;
|
||||
String jsonString = JsonParser.parseString(new Gson().toJson(beanList)).getAsJsonArray().toString();
|
||||
MMKV.defaultMMKV().encode("ApplicationLock", jsonString);
|
||||
Log.e("getAppPasswd", "onNext: " + jsonString);
|
||||
} else {
|
||||
MMKV.defaultMMKV().encode("ApplicationLock", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAppPasswd", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAppPasswd", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送正在运行的app信息
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public void sendRunningApp(Context context) {
|
||||
String packageName = TimeUtils.getInstance().getAppPackageName();
|
||||
Log.e("SendRunningApp", "packageName: " + packageName);
|
||||
long time = TimeUtils.getInstance().getStartTime();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("app_package", packageName);
|
||||
jsonObject.addProperty("version_name", ApkUtils.getAPPVersionName(context, packageName));
|
||||
jsonObject.addProperty("run_time", time / 1000);
|
||||
jsonObject.addProperty("app_name", ApkUtils.getAppNameByPackage(context, packageName));
|
||||
jsonObject.addProperty("status", 1);
|
||||
String jsonString = jsonObject.toString();
|
||||
NetInterfaceManager.getInstance().getRunningAppObservable(jsonString)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("SendRunningApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("SendRunningApp", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendRunningApp", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SendRunningApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// private void setTag(Context context, Set set) {
|
||||
// TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
|
||||
// tagAliasBean.action = ACTION_SET;
|
||||
// sequence++;
|
||||
// tagAliasBean.tags = set;
|
||||
// tagAliasBean.isAliasAction = false;
|
||||
// TagAliasOperatorHelper.getInstance().handleAction(context, sequence, tagAliasBean);
|
||||
// }
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aoleyun.os.BuildConfig;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetInterfaceManager;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.uiuiutils.ApkUtils;
|
||||
@@ -52,6 +53,7 @@ public class MainService extends Service {
|
||||
public void onCreate() {
|
||||
Log.e(TAG, "onCreate: ");
|
||||
registerTimeReceiver();
|
||||
registerRefreshReceiver();
|
||||
Aria.download(this).register();
|
||||
super.onCreate();
|
||||
}
|
||||
@@ -93,6 +95,27 @@ public class MainService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
public void registerRefreshReceiver() {
|
||||
mRefreshReceiver = new RefreshReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(AOLEYUN_REFRESH_DESKTOP);
|
||||
registerReceiver(mRefreshReceiver, filter);
|
||||
}
|
||||
|
||||
private RefreshReceiver mRefreshReceiver;
|
||||
|
||||
private static final String AOLEYUN_REFRESH_DESKTOP = "aoleyun_refresh_desktop_action";
|
||||
|
||||
private static class RefreshReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
NetInterfaceManager.getInstance().getAppPasswd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final static long ONE_HOURS_TIME = 60 * 60 * 1000;
|
||||
private final static long TEN_MINUTES_TIME = 60 * 10 * 1000;
|
||||
|
||||
@@ -218,6 +241,9 @@ public class MainService extends Service {
|
||||
if (mTimeChangedReceiver != null) {
|
||||
unregisterReceiver(mTimeChangedReceiver);
|
||||
}
|
||||
if (mRefreshReceiver != null) {
|
||||
unregisterReceiver(mRefreshReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
@Download.onTaskRunning
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.aoleyun.os.uiuiutils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
@@ -23,7 +24,7 @@ public class BitmapUtils {
|
||||
public static Drawable getRoundedBitmap(Drawable drawable, Context context) {
|
||||
Bitmap mBitmap= drawable2bitmap(drawable);
|
||||
|
||||
Bitmap bgBitmap = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
// Bitmap bgBitmap = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
|
||||
Bitmap mask = BitmapFactory.decodeResource(context.getResources(), R.drawable.mask);
|
||||
int width = mask.getWidth();
|
||||
@@ -219,7 +220,21 @@ public class BitmapUtils {
|
||||
drawable.draw(canvas);
|
||||
return bitmap;
|
||||
} else {
|
||||
return null;
|
||||
// 对于AdaptiveIconDrawable和其他Drawable,尝试绘制到Bitmap
|
||||
int width = drawable.getIntrinsicWidth();
|
||||
int height = drawable.getIntrinsicHeight();
|
||||
// 如果尺寸无效,使用默认尺寸
|
||||
if (width <= 0 || height <= 0) {
|
||||
// 设置一个默认尺寸,例如48dp
|
||||
float density = Resources.getSystem().getDisplayMetrics().density;
|
||||
width = (int) (48 * density);
|
||||
height = (int) (48 * density);
|
||||
}
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
drawable.draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user