update:2021.04.02
fix:新的app内部管控接口
add:
This commit is contained in:
FHT
2021-04-02 17:34:50 +08:00
parent a43068a1a1
commit b34694838c
6 changed files with 90 additions and 68 deletions

View File

@@ -12,7 +12,7 @@ android {
compileSdkVersion 29
defaultConfig {
applicationId "com.jiaoguanyi.appstore"
minSdkVersion 20
minSdkVersion 24
targetSdkVersion 29
// versionCode 105
@@ -57,7 +57,7 @@ android {
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "20f70bbeb78bad23eddd08d0", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value : "official",
channel_value: "official",
]
signingConfig signingConfigs.debug
/*********************************极光推送end************************************/
@@ -76,7 +76,7 @@ android {
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "52d81643665bb2cadacf0e9e", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value : "beta"
channel_value: "beta"
]
signingConfig signingConfigs.debug
/*********************************极光推送end************************************/
@@ -95,7 +95,7 @@ android {
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "a98c8a210687b4bb43c39c39", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value : "zhongyou"
channel_value: "zhongyou"
]
signingConfig signingConfigs.debug
/*********************************极光推送end************************************/
@@ -105,15 +105,15 @@ android {
newl {
flavorDimensions "default"
// versionCode 167
versionCode 1033
versionName "1.2.7"
// versionCode 168
versionCode 1036
versionName "1.2.8"
/*********************************极光推送************************************/
manifestPlaceholders = [
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
JPUSH_APPKEY : "52d81643665bb2cadacf0e9e", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
channel_value : "newl"
channel_value: "newl"
]
signingConfig signingConfigs.debug
/*********************************极光推送end************************************/
@@ -135,7 +135,7 @@ android {
keyPassword "123456"
v2SigningEnabled false
}
release {// 签名文件
storeFile file("src/main/doc/xueshibaoos.jks")
storePassword "123456"

View File

@@ -80,6 +80,11 @@ public class MainPresenter implements MainContact.Presenter {
this.mView = null;
}
private boolean isOfficialVersion() {
String channelValue = JGYUtils.getInstance().getStringMetaData();
return "official".equals(channelValue);
}
/**
* 通过sn获取用户信息
*/
@@ -268,8 +273,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void updateDeviceInfo() {
String channel_value = JGYUtils.getInstance().getStringMetaData();
if ("official".equals(channel_value)) {
if (isOfficialVersion()) {
mView.updateDeviceInfoFinished();
return;
}
@@ -328,8 +332,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getSnTimeControl() {
String channel_value = JGYUtils.getInstance().getStringMetaData();
if ("official".equals(channel_value)) {
if (isOfficialVersion()) {
mView.getSnTimeControlFinished();
return;
}
@@ -551,8 +554,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void checkTestUpdate() {
String channel_value = JGYUtils.getInstance().getStringMetaData();
if ("official".equals(channel_value)) {
if (isOfficialVersion()) {
mView.checkTestUpdateFinished();
return;
}
@@ -644,8 +646,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getDeviceBatch(String packageList) {
String channel_value = JGYUtils.getInstance().getStringMetaData();
if ("official".equals(channel_value)) {
if (isOfficialVersion()) {
mView.getDeviceBatchFinished();
return;
}
@@ -766,7 +767,7 @@ public class MainPresenter implements MainContact.Presenter {
mView.getBrowserListFinished(white);
if (!TextUtils.isEmpty(white)) {
String homePage = Settings.System.getString(mContext.getContentResolver(), "homepagURL");
if (!white.contains(homePage) && !TextUtils.isEmpty(homePage)) {
if (!TextUtils.isEmpty(homePage) && !white.contains(homePage)) {
white += "," + homePage;
}
boolean whiteList = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", white);
@@ -984,6 +985,7 @@ public class MainPresenter implements MainContact.Presenter {
Log.e("getAppIDControl", "onNext: ");
try {
String bodyString = responseBody.string();
Log.e("getAppIDControl", "bodyString: " + bodyString);
JsonObject jsonObject = JsonParser.parseString(bodyString).getAsJsonObject();
int code = jsonObject.get("code").getAsInt();
if (code == 200) {
@@ -1020,8 +1022,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void setAppinsideWeb() {
String channel_value = JGYUtils.getInstance().getStringMetaData();
if ("official".equals(channel_value)) {
if (isOfficialVersion()) {
getAppinsideWeb();
} else {
getNewAppinsideWeb();
@@ -1083,6 +1084,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void onComplete() {
Log.e("getNewAppinsideWeb", "onComplete: ");
mView.setAppinsideWebFinished();
}
});
}
@@ -1135,6 +1137,10 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void setLogoImg() {
if (isOfficialVersion()) {
mView.setLogoImgFinished();
return;
}
NetInterfaceManager.getInstance()
.getLogoImgObservable()
.subscribe(new Observer<BaseResponse<LogoImg>>() {
@@ -1178,9 +1184,8 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getScreenLockState() {
String channel_value = JGYUtils.getInstance().getStringMetaData();
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 1);
if ("official".equals(channel_value) || locked == 1) {
if (isOfficialVersion() || locked == 1) {
mView.setScreenLockStateFinished(false, "");
return;
}
@@ -1222,8 +1227,7 @@ public class MainPresenter implements MainContact.Presenter {
@Override
public void getDefaultDesktop() {
String channel_value = JGYUtils.getInstance().getStringMetaData();
if ("official".equals(channel_value)) {
if (isOfficialVersion()) {
mView.getDefaultDesktopFinished();
return;
}

View File

@@ -502,7 +502,7 @@ public class HTTPInterface {
String white = data.getString("white");
String homePage = Settings.System.getString(context.getContentResolver(), "homepagURL");
if (!TextUtils.isEmpty(white)) {
if (!white.contains(homePage) && !TextUtils.isEmpty(homePage)) {
if (!TextUtils.isEmpty(homePage) && !white.contains(homePage)) {
white += "," + homePage;
}
boolean whiteList = Settings.System.putString(context.getContentResolver(), "DeselectBrowserArray", white);

View File

@@ -911,7 +911,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
case 200:
str1 = jSONObject.getJSONObject("data").optString("ids");
str2 = jSONObject.getJSONObject("data").optString("package");
writeDeselectIDtoSystem(str1, str2);
JGYUtils.getInstance().writeDeselectIDtoSystem(str1, str2);
return;
}
Log.e("mjsheng", "getDeselectID---code is -200");
@@ -1194,29 +1194,29 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
//应用id管控
private void writeDeselectIDtoSystem(String s1, String result) {
if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
String appstore = "com.jiaoguanyi.appstore";
String store = "com.jiaoguanyi.store";
Log.e("writeDeselectIDtoSystem", result);
if (!result.contains(appstore)) {
result = result + "," + appstore;
}
if (!result.contains(store)) {
result = result + "," + store;
}
String olddeselectViewArray = Settings.System.getString(this.mContext.getContentResolver(), "qch_app_forbid_id");
Log.e("SystemSetting", "olddeselectViewArray---------" + olddeselectViewArray);
Settings.System.putString(this.mContext.getContentResolver(), "qch_app_forbid_id", result);
Settings.System.putString(this.mContext.getContentResolver(), "DeselectViewArray", s1);
Log.e("qch_app_forbid_id", "qch_app_forbid_id---------" + result);
Log.e("SystemSetting", "deselectViewArray---------" + s1);
return;
} else {
Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
Settings.System.putString(this.mContext.getContentResolver(), "DeselectViewArray", "Invalid");
}
}
// private void writeDeselectIDtoSystem(String s1, String result) {
// if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
// String appstore = "com.jiaoguanyi.appstore";
// String store = "com.jiaoguanyi.store";
// Log.e("writeDeselectIDtoSystem", result);
// if (!result.contains(appstore)) {
// result = result + "," + appstore;
// }
// if (!result.contains(store)) {
// result = result + "," + store;
// }
// String olddeselectViewArray = Settings.System.getString(this.mContext.getContentResolver(), "qch_app_forbid_id");
// Log.e("SystemSetting", "olddeselectViewArray---------" + olddeselectViewArray);
// Settings.System.putString(this.mContext.getContentResolver(), "qch_app_forbid_id", result);
// Settings.System.putString(this.mContext.getContentResolver(), "DeselectViewArray", s1);
// Log.e("qch_app_forbid_id", "qch_app_forbid_id---------" + result);
// Log.e("SystemSetting", "deselectViewArray---------" + s1);
// return;
// } else {
// Log.e("mjsheng", "writeDeselectIDtoSystem is null:");
// Settings.System.putString(this.mContext.getContentResolver(), "DeselectViewArray", "Invalid");
// }
// }
public void settingLock(String s) {

View File

@@ -32,6 +32,8 @@ import com.jiaoguanyi.appstore.utils.SaveListUtils;
import com.jiaoguanyi.appstore.utils.SysSettingUtils;
import com.jiaoguanyi.appstore.utils.TimeUtils;
import cn.jpush.android.api.JPushInterface;
public class MainService extends Service implements MainContact.MainView {
private MainPresenter mPresenter;
private static final String TAG = MainService.class.getSimpleName();
@@ -70,8 +72,9 @@ public class MainService extends Service implements MainContact.MainView {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
JPushInterface.init(this);
if (MainActivity.isForeground) {
Log.e(TAG, "onStartCommand: MainActivity: " + MainActivity.isForeground);
Log.e(TAG, "onStartCommand: MainActivity: isForeground: " + MainActivity.isForeground);
} else {
if (((SystemClock.elapsedRealtime() - startCommandTime) < 60000) && startCommandTime != 0) {
Log.e(TAG, "onStartCommand: " + "启动时间过短");

View File

@@ -40,6 +40,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
public class JGYUtils {
@@ -237,26 +238,40 @@ public class JGYUtils {
}
/**
* @param s1 需要管控的ID
* @param result 应用程序包名
* @param ids 需要管控的ID
* @param packages 应用程序包名
*/
public void writeDeselectIDtoSystem(String s1, String result) {
if (!TextUtils.isEmpty(s1) && !TextUtils.isEmpty(result)) {
String appstore = "com.jiaoguanyi.appstore";
String store = "com.jiaoguanyi.store";
Log.e("writeDeselectIDtoSystem", "result: " + result);
if (!result.contains(appstore)) {
result = result + "," + appstore;
public void writeDeselectIDtoSystem(String ids, String packages) {
if (!TextUtils.isEmpty(ids) && !TextUtils.isEmpty(packages)) {
ArrayList<String> idArrayList = new ArrayList<>(Arrays.asList(ids.split(",")));
ArrayList<String> packageArrayList = new ArrayList<>(Arrays.asList(packages.split(",")));
LinkedHashSet<String> idHashSet = new LinkedHashSet<>(idArrayList);
LinkedHashSet<String> packageHashSet = new LinkedHashSet<>(packageArrayList);
ArrayList<String> idList = new ArrayList<>(idHashSet);
ArrayList<String> packageList = new ArrayList<>(packageHashSet);
StringBuilder idStringBuilder = new StringBuilder();
for (String id : idList) {
if (idStringBuilder.length() > 0) {
idStringBuilder.append(",");
}
idStringBuilder.append(id);
}
if (!result.contains(store)) {
result = result + "," + store;
StringBuilder packageStringBuilder = new StringBuilder();
for (String pkg : packageList) {
if (packageStringBuilder.length() > 0) {
packageStringBuilder.append(",");
}
packageStringBuilder.append(pkg);
}
String olddeselectViewArray = Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid_id");
Log.e("writeDeselectIDtoSystem", "olddeselectViewArray" + olddeselectViewArray);
Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid_id", result);
Settings.System.putString(mContext.getContentResolver(), "DeselectViewArray", s1);
Log.e("writeDeselectIDtoSystem", "qch_app_forbid_id" + result);
Log.e("writeDeselectIDtoSystem", "deselectViewArray" + s1);
Log.e("writeDeselectIDtoSystem", "olddeselectViewArray: " + olddeselectViewArray);
Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid_id", packageStringBuilder.toString());
Settings.System.putString(mContext.getContentResolver(), "DeselectViewArray", idStringBuilder.toString());
Log.e("writeDeselectIDtoSystem", "qch_app_forbid_id: " + packageStringBuilder.toString());
Log.e("writeDeselectIDtoSystem", "deselectViewArray: " + idStringBuilder.toString());
} else {
Log.e("writeDeselectIDtoSystem", "writeDeselectIDtoSystem is null:");
Settings.System.putString(mContext.getContentResolver(), "DeselectViewArray", "Invalid");
@@ -311,7 +326,7 @@ public class JGYUtils {
}
}
public void setNewAppinsideWeb(BaseResponse<List<NewAppground>> response){
public void setNewAppinsideWeb(BaseResponse<List<NewAppground>> response) {
if (response.code == 200) {
List<NewAppground> appgrounds = response.data;
if (appgrounds != null && appgrounds.size() > 0) {
@@ -701,7 +716,7 @@ public class JGYUtils {
if (systemFile.exists()) {
if (systemFile.delete()) {
Log.e(TAG, "removeBootanimation: delete: " + "ture");
}else {
} else {
Log.e(TAG, "removeBootanimation: delete: " + "false");
}
}