Commit 248269da by liimin

refactor(permission): 改为按需申请存储权限并优化降级处理

1 parent 422a45f3
# ===== 构建产物(自动生成,请勿提交)=====
build/
*/build/
release/
captures/
*.apk
*.aar
*.ap_
*.aab
*.dex
*.class
# ===== Gradle 缓存(不是 wrapper,wrapper 需保留)=====
.gradle/
# ===== 本地环境配置(含 SDK 绝对路径,禁止提交)=====
local.properties
# ===== 签名密钥(含私钥,泄露即失窃!)=====
*.jks
*.keystore
# ===== IDE / Android Studio 工程文件 =====
.idea/
*.iml
*.iml~
*.ipr
*.iws
.DS_Store
Thumbs.db
# ===== 日志与临时文件 =====
*.log
log.txt
tmpmob/
# ===== WorkBuddy 工作目录(含本地工作记忆,禁止提交)=====
.workbuddy/
...@@ -35,6 +35,57 @@ public class PermissionRequestUtil { ...@@ -35,6 +35,57 @@ public class PermissionRequestUtil {
request(context, callback, Permission.Group.STORAGE); request(context, callback, Permission.Group.STORAGE);
} }
/**
* 统一:使用存储相关功能前按需申请存储权限(合规整改路线 A)。
* 要点:
* 1. 仅在用户真正使用存储功能时申请(非启动/首页前置),不触发"启动前置弹窗"违规;
* 2. 用户拒绝后仅降级(存不了文件,但功能不崩、不阻断其他核心功能),不触发"拒绝即阻断"违规;
* 3. 拒绝过一次即记标记,后续进入不再弹窗,避免反复弹窗;
* 4. 不额外申请 MANAGE 之外的权限,权限范围收敛在存储组。
*
* @param context 上下文(需 Activity,用于弹窗与权限请求 UI)
* @param onGranted 已具备权限或用户授权后执行的实际动作
* @param onDenied 用户拒绝/不可用时降级处理(不抛异常、不阻断)
*/
public static void requestStorageBeforeAction(Context context, Runnable onGranted, Runnable onDenied) {
if (sStorageActionDeclined) {
if (onDenied != null) onDenied.run();
return;
}
if (checkAppStoragePermissions(context)) {
if (onGranted != null) onGranted.run();
return;
}
showRequestStoragePermissionTipsDialog(context, new PermissionDialogUtil.IRequirePermissionAll() {
@Override
public void OnClickConfirm() {
AndPermission.with(context)
.permission(Permission.Group.STORAGE)
.rationale(new DefaultRationale())
.onGranted(permissions -> {
if (onGranted != null) onGranted.run();
})
.onDenied(permissions -> {
sStorageActionDeclined = true;
if (AndPermission.hasAlwaysDeniedPermission(context, permissions)) {
new PermissionSetting(context).showSetting(permissions);
}
if (onDenied != null) onDenied.run();
})
.start();
}
@Override
public void OnClickCancel() {
sStorageActionDeclined = true;
if (onDenied != null) onDenied.run();
}
});
}
/** 存储权限曾被用户拒绝;置 true 后 requestStorageBeforeAction 直接降级,不再弹窗。 */
private static boolean sStorageActionDeclined = false;
public static void requestLocationPermissions(Context context, PermissionReqCallback callback) { public static void requestLocationPermissions(Context context, PermissionReqCallback callback) {
LogUtils.d(TAG, "requestLocationPermissions with callback"); LogUtils.d(TAG, "requestLocationPermissions with callback");
request(context, callback, Permission.Group.LOCATION); request(context, callback, Permission.Group.LOCATION);
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
android:layout_marginLeft="@dimen/public_pad_10dp" android:layout_marginLeft="@dimen/public_pad_10dp"
android:layout_marginRight="@dimen/public_pad_5dp" android:layout_marginRight="@dimen/public_pad_5dp"
android:gravity="bottom" android:gravity="bottom"
android:text="为了应用正常提供服务,我们需要您的手机开启如下权限:" android:text="开启对应权限可提升使用体验。您也可以不授权,相关功能仍可使用(部分能力可能受限):"
android:textColor="@color/public_color_333333" android:textColor="@color/public_color_333333"
android:textSize="@dimen/public_font_16sp" /> android:textSize="@dimen/public_font_16sp" />
<!--android:gravity="center_horizontal|bottom"--> <!--android:gravity="center_horizontal|bottom"-->
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
android:layout_marginLeft="@dimen/public_pad_10dp" android:layout_marginLeft="@dimen/public_pad_10dp"
android:layout_marginRight="@dimen/public_pad_5dp" android:layout_marginRight="@dimen/public_pad_5dp"
android:gravity="bottom" android:gravity="bottom"
android:text="为了应用正常提供服务,我们需要您的手机开启如下权限:" android:text="开启对应权限可提升使用体验。您也可以不授权,相关功能仍可使用(部分能力可能受限):"
android:textColor="@color/public_color_333333" android:textColor="@color/public_color_333333"
android:textSize="@dimen/public_font_16sp" /> android:textSize="@dimen/public_font_16sp" />
......
...@@ -13,8 +13,8 @@ android { ...@@ -13,8 +13,8 @@ android {
targetSdkVersion 30 targetSdkVersion 30
// versionCode 3504 // versionCode 3504
// versionName "3.7.0." + getCurrentVersionCode() // versionName "3.7.0." + getCurrentVersionCode()
versionCode 3715 versionCode 3716
versionName "3.7.1.5" versionName "3.7.1.6"
//V3.3.5.2版本开始,单独打包32位和64位的版本。应用商店根据实际情况同时上架两个版本或只上架64位版本 //V3.3.5.2版本开始,单独打包32位和64位的版本。应用商店根据实际情况同时上架两个版本或只上架64位版本
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//自定义Dialog控件DialogX要使用开启组件的实时模糊效果(例如IOS主题) //自定义Dialog控件DialogX要使用开启组件的实时模糊效果(例如IOS主题)
......
...@@ -514,7 +514,8 @@ public class VideoTailorToolActivity extends BaseAppCompatActivity implements Vi ...@@ -514,7 +514,8 @@ public class VideoTailorToolActivity extends BaseAppCompatActivity implements Vi
if (ClickUtil.isFastDoubleClick()) { if (ClickUtil.isFastDoubleClick()) {
return; return;
} }
complete(); com.glsx.commonres.permission.PermissionRequestUtil.requestStorageBeforeAction(this, this::complete,
() -> Toast.makeText(this, "未授权存储权限,无法保存", Toast.LENGTH_SHORT).show());
break; break;
case R.id.tv_tailor://裁剪 case R.id.tv_tailor://裁剪
videoTailor(); videoTailor();
......
...@@ -191,6 +191,7 @@ public class PhotoDamageFragment extends BaseFragment implements View.OnClickLis ...@@ -191,6 +191,7 @@ public class PhotoDamageFragment extends BaseFragment implements View.OnClickLis
//事故救援发生的经纬度 //事故救援发生的经纬度
public double mDamageLatitude = 0; public double mDamageLatitude = 0;
public double mDamageLongitude = 0; public double mDamageLongitude = 0;
public String mDamageAddress = "";
//救援门店所在的地址及经纬度 //救援门店所在的地址及经纬度
private String storeAddress; private String storeAddress;
private String storeCity; private String storeCity;
...@@ -671,6 +672,7 @@ public class PhotoDamageFragment extends BaseFragment implements View.OnClickLis ...@@ -671,6 +672,7 @@ public class PhotoDamageFragment extends BaseFragment implements View.OnClickLis
mDamageLatitude = resultBean.getLatitude(); mDamageLatitude = resultBean.getLatitude();
mDamageLongitude = resultBean.getLongitude(); mDamageLongitude = resultBean.getLongitude();
mDamageAddress = resultBean.getName();
setUserMapCenter(mDamageLatitude, mDamageLongitude); setUserMapCenter(mDamageLatitude, mDamageLongitude);
tv_accident_positon.setText(resultBean.getName()); tv_accident_positon.setText(resultBean.getName());
tv_accident_positon_address.setText(resultBean.getDistrict()); tv_accident_positon_address.setText(resultBean.getDistrict());
...@@ -1031,7 +1033,15 @@ public class PhotoDamageFragment extends BaseFragment implements View.OnClickLis ...@@ -1031,7 +1033,15 @@ public class PhotoDamageFragment extends BaseFragment implements View.OnClickLis
String lat = String.valueOf(latLngGaode[0]); String lat = String.valueOf(latLngGaode[0]);
String lng = String.valueOf(latLngGaode[1]); String lng = String.valueOf(latLngGaode[1]);
String phone = AccountManager.getInstance().getAccountMobile(); String phone = AccountManager.getInstance().getAccountMobile();
String mAddress = LocationManager.getInstance().getmAmapLocationn().getAddress(); // 地址优先使用用户手动选择的 POI 名称,避免未授权定位时 getmAmapLocationn() 为 null 导致 NPE;
// 其次回退手机 GPS 地址;均无则给空串,保证碰撞救援在无定位权限时也能正常提交
String mAddress = "";
if (!TextUtils.isEmpty(mDamageAddress)) {
mAddress = mDamageAddress;
} else if (LocationManager.getInstance().getmAmapLocationn() != null) {
String gpsAddress = LocationManager.getInstance().getmAmapLocationn().getAddress();
mAddress = gpsAddress == null ? "" : gpsAddress;
}
// LoadingDialog.getInstance().showLoadingDialogHideMeg(); // LoadingDialog.getInstance().showLoadingDialogHideMeg();
showDialog("", getResources().getString(R.string.send_requesting), TYPE_WAITDIALOG, false); showDialog("", getResources().getString(R.string.send_requesting), TYPE_WAITDIALOG, false);
LogUtils.d(TAG, "sendDamageEventToServer damageJsonArray = " + mediaList.toString()); LogUtils.d(TAG, "sendDamageEventToServer damageJsonArray = " + mediaList.toString());
......
...@@ -553,27 +553,6 @@ public class IntelligentCarFragment extends BaseFragment implements View.OnClick ...@@ -553,27 +553,6 @@ public class IntelligentCarFragment extends BaseFragment implements View.OnClick
// boolean isPermissionAgree = MmkvUtil.getBooleanPref(CommonConst.PREF_KEY_PERMISSION_AGREED, false); // boolean isPermissionAgree = MmkvUtil.getBooleanPref(CommonConst.PREF_KEY_PERMISSION_AGREED, false);
// Log.d("hyh","fasdtyasfasfvtgfvt "+Environment.isExternalStorageManager()); // Log.d("hyh","fasdtyasfasfvtgfvt "+Environment.isExternalStorageManager());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !Environment.isExternalStorageManager()) {
showDialogHYH();
return;
}
if (!PermissionRequestUtil.checkAppAllPermissions(requireContext())) {
PermissionRequestUtil.showRequestAllPermissionTipsDialog(getContext(), new PermissionDialogUtil.IRequirePermissionAll() {
@Override
public void OnClickConfirm() {
MmkvUtil.setPref(CommonConst.PREF_KEY_PERMISSION_AGREED, true);
showRequestPermissionAllDialog();
}
@Override
public void OnClickCancel() {
MmkvUtil.setPref(CommonConst.PREF_KEY_PERMISSION_AGREED, true);
}
});
return;
}
if (null != item) { if (null != item) {
if (item.getIsCdp()) {//如果是智能投放,不做处理,由mpaas控制配置 if (item.getIsCdp()) {//如果是智能投放,不做处理,由mpaas控制配置
return; return;
...@@ -631,7 +610,9 @@ public class IntelligentCarFragment extends BaseFragment implements View.OnClick ...@@ -631,7 +610,9 @@ public class IntelligentCarFragment extends BaseFragment implements View.OnClick
// break; // break;
case CommonConst.DEVICE_TYPE_ID_BT_CAR_KEY://蓝牙车钥匙 case CommonConst.DEVICE_TYPE_ID_BT_CAR_KEY://蓝牙车钥匙
uploadMPaaSAction(ParamsConfig.INTELLIGENT_CAR_CARD_BT_CAR_KEY); uploadMPaaSAction(ParamsConfig.INTELLIGENT_CAR_CARD_BT_CAR_KEY);
gotoBluetoothCarKeyPage(item.getSn(), item.getUserId(), item.getPlateNumber()); com.glsx.commonres.permission.PermissionRequestUtil.requestStorageBeforeAction(requireContext(),
() -> gotoBluetoothCarKeyPage(item.getSn(), item.getUserId(), item.getPlateNumber()),
() -> gotoBluetoothCarKeyPage(item.getSn(), item.getUserId(), item.getPlateNumber()));
break; break;
case CommonConst.DEVICE_TYPE_ID_WIFI_DVR://WiFi直连固化卡片 case CommonConst.DEVICE_TYPE_ID_WIFI_DVR://WiFi直连固化卡片
String ssid = AppUtils.getCurWifiName(getContext()); String ssid = AppUtils.getCurWifiName(getContext());
......
...@@ -190,22 +190,6 @@ public class IntelligentServerFragment extends BaseFragment implements AdapterVi ...@@ -190,22 +190,6 @@ public class IntelligentServerFragment extends BaseFragment implements AdapterVi
* @param item 点击设备对象 * @param item 点击设备对象
*/ */
private void doClickItem(ServerItemBean item) { private void doClickItem(ServerItemBean item) {
if (!PermissionRequestUtil.checkAppAllPermissions(requireContext())) {
PermissionRequestUtil.showRequestAllPermissionTipsDialog(getContext(), new PermissionDialogUtil.IRequirePermissionAll() {
@Override
public void OnClickConfirm() {
MmkvUtil.setPref(CommonConst.PREF_KEY_PERMISSION_AGREED, true);
showRequestPermissionAllDialog();
}
@Override
public void OnClickCancel() {
MmkvUtil.setPref(CommonConst.PREF_KEY_PERMISSION_AGREED, true);
}
});
return;
}
if (null != item) { if (null != item) {
if (!AccountManager.getInstance().isLogin()) { if (!AccountManager.getInstance().isLogin()) {
showLoginDialog(); showLoginDialog();
......
...@@ -108,7 +108,6 @@ public class MainFragment extends BaseFragment implements ILoginBaseObserver{ ...@@ -108,7 +108,6 @@ public class MainFragment extends BaseFragment implements ILoginBaseObserver{
intoPageFragment(); intoPageFragment();
initView(); initView();
LoginManager.getInstance().registerListener(this); LoginManager.getInstance().registerListener(this);
requestPermissionAll();
//增加判断,防止重复注册BUG //增加判断,防止重复注册BUG
if(!EventBus.getDefault().isRegistered(this)){ if(!EventBus.getDefault().isRegistered(this)){
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
......
...@@ -443,11 +443,9 @@ public class RemoteFileListView extends RelativeLayout implements RadioGroup.OnC ...@@ -443,11 +443,9 @@ public class RemoteFileListView extends RelativeLayout implements RadioGroup.OnC
} }
public void doMenuDownload() { public void doMenuDownload() {
if (hadRequestPermission()) { com.glsx.commonres.permission.PermissionRequestUtil.requestStorageBeforeAction(getContext(),
dealMenuDownload(); this::dealMenuDownload,
} else { () -> Toast.makeText(getContext(), "未授权存储权限,无法下载文件", Toast.LENGTH_SHORT).show());
requestPermissionStorage();
}
} }
private boolean hadRequestPermission() { private boolean hadRequestPermission() {
......
...@@ -298,10 +298,14 @@ public class CameraViewLive extends FrameLayout implements View.OnClickListener, ...@@ -298,10 +298,14 @@ public class CameraViewLive extends FrameLayout implements View.OnClickListener,
mRequestTakeRecorder = true; mRequestTakeRecorder = true;
onClickStartLocalRecord(); onClickStartLocalRecord();
return true; return true;
} else {
requestPermissionStorage();
return false;
} }
com.glsx.commonres.permission.PermissionRequestUtil.requestStorageBeforeAction(getContext(),
() -> {
mRequestTakeRecorder = true;
onClickStartLocalRecord();
},
() -> ToastUtil.showCenterTop("未授权存储权限,无法本地录像"));
return false;
} }
private void sendTakeVideoCmdToDvr() { private void sendTakeVideoCmdToDvr() {
......
...@@ -130,7 +130,8 @@ public class CutViewActivity extends MPaasActivity implements OnClickListener { ...@@ -130,7 +130,8 @@ public class CutViewActivity extends MPaasActivity implements OnClickListener {
finish(); finish();
break; break;
case R.id.save: case R.id.save:
OnCut(); com.glsx.commonres.permission.PermissionRequestUtil.requestStorageBeforeAction(this, this::OnCut,
() -> Toast.makeText(this, "未授权存储权限,无法保存", Toast.LENGTH_SHORT).show());
break; break;
default: default:
break; break;
......
...@@ -32,6 +32,7 @@ import java.net.URL; ...@@ -32,6 +32,7 @@ import java.net.URL;
*/ */
public class DownloadAPk { public class DownloadAPk {
private static int FILE_LEN = 0; private static int FILE_LEN = 0;
private static boolean mDownloadOk = false;
private static RemoteViews mNotifiviews; private static RemoteViews mNotifiviews;
public static String APK_UPGRADE = Environment.getExternalStorageDirectory() + "/aicar/apk/aicar.apk"; public static String APK_UPGRADE = Environment.getExternalStorageDirectory() + "/aicar/apk/aicar.apk";
private static PendingIntent nullIntent; private static PendingIntent nullIntent;
...@@ -45,17 +46,26 @@ public class DownloadAPk { ...@@ -45,17 +46,26 @@ public class DownloadAPk {
if (Build.VERSION.SDK_INT >= 26) { if (Build.VERSION.SDK_INT >= 26) {
boolean b = context.getPackageManager().canRequestPackageInstalls(); boolean b = context.getPackageManager().canRequestPackageInstalls();
if (b) { if (b) {
downloadAPK(url, null); requestAndDownload(context, url);
} else { } else {
//请求安装未知应用来源的权限 //请求安装未知应用来源的权限
startInstallPermissionSettingActivity(); startInstallPermissionSettingActivity();
} }
} else { } else {
downloadAPK(url, null); requestAndDownload(context, url);
} }
} }
/** /**
* 下载前统一申请存储权限(合规整改路线 A):拒绝则降级提示,不崩溃、不误导。
*/
private static void requestAndDownload(Context context, String url) {
com.glsx.commonres.permission.PermissionRequestUtil.requestStorageBeforeAction(context,
() -> downloadAPK(url, null),
() -> Toast.makeText(context, "未授权存储权限,无法下载更新包", Toast.LENGTH_LONG).show());
}
/**
* 开启安装APK权限(适配8.0) * 开启安装APK权限(适配8.0)
*/ */
@RequiresApi(api = Build.VERSION_CODES.O) @RequiresApi(api = Build.VERSION_CODES.O)
...@@ -156,10 +166,13 @@ public class DownloadAPk { ...@@ -156,10 +166,13 @@ public class DownloadAPk {
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
Toast.makeText(mContext, "下载完成,请点击通知栏完成升级", Toast.LENGTH_LONG).show();
// finishNotify();
NotifyTool.cleanNotification(mContext, 0); NotifyTool.cleanNotification(mContext, 0);
if (mDownloadOk && new File(APK_UPGRADE).exists()) {
Toast.makeText(mContext, "下载完成,请点击通知栏完成升级", Toast.LENGTH_LONG).show();
mContext.startActivity(getInstallAppIntent(APK_UPGRADE)); mContext.startActivity(getInstallAppIntent(APK_UPGRADE));
} else {
Toast.makeText(mContext, "下载失败,请检查网络或存储权限后重试", Toast.LENGTH_LONG).show();
}
} }
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
android:layout_marginLeft="@dimen/public_pad_10dp" android:layout_marginLeft="@dimen/public_pad_10dp"
android:layout_marginRight="@dimen/public_pad_5dp" android:layout_marginRight="@dimen/public_pad_5dp"
android:gravity="bottom" android:gravity="bottom"
android:text="请授予App外部存储权限,否则文件无法保存" android:text="如需将文件保存到本地,可授权外部存储权限;不授权不影响其他功能使用"
android:textColor="@color/public_color_333333" android:textColor="@color/public_color_333333"
android:textSize="@dimen/public_font_16sp" /> android:textSize="@dimen/public_font_16sp" />
......
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.java.home=D\:\\soft\\Java\\jdk1.8.0_261
#Gradle缓存是Gradle 3.5的新特性,当缓存开启时,Gradle将缓存并重用之前构建的结果
org.gradle.caching=true
#Disables R8 for all modules.
android.enableR8=false
MobSDK.spEdition=FP
#add
#org.gradle.jvmargs=-Xmx1536m -Dfile.encoding=UTF-8
#android.enableAapt2=false
#systemProp.http.proxyHost=mirrors.aliyun.com
#systemProp.http.proxyPort=80
#systemProp.https.proxyHost=mirrors.aliyun.com
#systemProp.https.proxyPort=80
android.overridePathCheck=true
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip #distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
distributionUrl=https\://mirrors.huaweicloud.com/gradle/gradle-6.1.1-bin.zip #distributionUrl=https\://mirrors.huaweicloud.com/gradle/gradle-6.1.1-bin.zip
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-6.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
...@@ -30,6 +30,7 @@ import com.rxjava.rxlife.RxLife; ...@@ -30,6 +30,7 @@ import com.rxjava.rxlife.RxLife;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import rxhttp.RxHttp; import rxhttp.RxHttp;
...@@ -695,8 +696,16 @@ public class BindDevicesManager { ...@@ -695,8 +696,16 @@ public class BindDevicesManager {
public void bindActiveDevice(String sn, String checkCode, String brandId, String seriesId, public void bindActiveDevice(String sn, String checkCode, String brandId, String seriesId,
CarBindDeviceCallBack resultCallBack) { CarBindDeviceCallBack resultCallBack) {
String url = HttpConst.SERVER_HTTP_ADDRESS; String url = HttpConst.SERVER_HTTP_ADDRESS;
Map<String, String> bindActiveParams = RxHttpManager.getBindActiveDeviceParams(sn, checkCode, brandId, seriesId);
StringBuilder fullUrl = new StringBuilder(url);
boolean firstParam = true;
for (Map.Entry<String, String> entry : bindActiveParams.entrySet()) {
fullUrl.append(firstParam ? "?" : "&").append(entry.getKey()).append("=").append(entry.getValue());
firstParam = false;
}
LogUtils.d(HTTP_TAG, "bindActiveDevice 完整请求地址:" + fullUrl.toString());
RxHttp.get(url) RxHttp.get(url)
.addAll(RxHttpManager.getBindActiveDeviceParams(sn, checkCode, brandId, seriesId)) .addAll(bindActiveParams)
.asClass(CarBindDeviceEntity.class) .asClass(CarBindDeviceEntity.class)
.subscribe(deviceBindEntity -> { .subscribe(deviceBindEntity -> {
if (HttpSessionErrorHandler.isHttpRequestSuccess(deviceBindEntity.getCode())) { if (HttpSessionErrorHandler.isHttpRequestSuccess(deviceBindEntity.getCode())) {
...@@ -705,11 +714,11 @@ public class BindDevicesManager { ...@@ -705,11 +714,11 @@ public class BindDevicesManager {
} else { } else {
resultCallBack.onCarBindDeviceFailure(deviceBindEntity.getCode(), deviceBindEntity.getMessage()); resultCallBack.onCarBindDeviceFailure(deviceBindEntity.getCode(), deviceBindEntity.getMessage());
} }
LogUtils.d(HTTP_TAG, "bindCheckDevice请求成功返回:" + deviceBindEntity.toString()); LogUtils.d(HTTP_TAG, "bindActiveDevice请求成功返回:" + deviceBindEntity.toString());
}, throwable -> { }, throwable -> {
//请求失败 //请求失败
resultCallBack.onCarBindDeviceFailure(HttpConstCode.SERVER_ERROR, "服务器异常"); resultCallBack.onCarBindDeviceFailure(HttpConstCode.SERVER_ERROR, "服务器异常");
LogUtils.d(HTTP_TAG, "bindCheckDevice请求失败throwable =" + throwable.toString()); LogUtils.d(HTTP_TAG, "bindActiveDevice请求失败throwable =" + throwable.toString());
}); });
} }
......
@echo off
cd /d %~dp0..
echo ============================================
echo AiCar debug APK build (signed with release keystore)
echo ============================================
echo.
echo Start build, first run downloads deps, please wait ...
call gradlew.bat assembleDebug
if errorlevel 1 (
echo.
echo [ERROR] BUILD FAILED, no new APK generated. Skip install.
echo Fix compile errors above, then re-run this script.
pause
exit /b 1
)
echo.
echo BUILD DONE. APK location below:
dir app\build\outputs\apk\debug\*.apk
echo.
echo Install latest debug APK to device:
pushd app\build\outputs\apk\debug
for /f "delims=" %%f in ('dir /b /o-d *.apk 2^>nul') do (
adb install -r "%%f"
goto :installed
)
:installed
popd
echo.
pause
@echo off
cd /d %~dp0..
echo ============================================
echo AiCar release APK build (signed)
echo ============================================
echo.
echo Start build, please wait ...
call gradlew.bat assembleRelease
echo.
echo BUILD DONE. APK location below:
dir app\build\outputs\apk\release\*.apk
echo.
echo Install latest release APK to device:
pushd app\build\outputs\apk\release
for %%f in (*.apk) do adb install -r "%%f"
popd
echo.
pause
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!