version:2.6
fix:修复userdebug报错 add:
This commit is contained in:
@@ -67,8 +67,8 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
beta {
|
beta {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 16
|
versionCode 17
|
||||||
versionName "2.5"
|
versionName "2.6"
|
||||||
}
|
}
|
||||||
|
|
||||||
official {
|
official {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<!--百度-->
|
<!--百度-->
|
||||||
<!-- 这个权限用于进行网络定位-->
|
<!-- 这个权限用于进行网络定位-->
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
|
|||||||
@@ -110,18 +110,6 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
|||||||
|
|
||||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
// ApkUtils.openApp(this, "com.android.settings");
|
|
||||||
//静音
|
|
||||||
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
|
||||||
int ringMax = audioManager.getStreamMinVolumeInt(AudioManager.STREAM_RING);
|
|
||||||
audioManager.setStreamVolume(AudioManager.STREAM_RING, ringMax, 0);
|
|
||||||
int musicMax = audioManager.getStreamMinVolumeInt(AudioManager.STREAM_MUSIC);
|
|
||||||
int voiceMax = audioManager.getStreamMinVolumeInt(AudioManager.STREAM_VOICE_CALL);
|
|
||||||
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, voiceMax, 0);
|
|
||||||
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicMax, 0); //音乐音量
|
|
||||||
}
|
|
||||||
|
|
||||||
setOnClickListener();
|
setOnClickListener();
|
||||||
tv_customversion.setText(JGYUtils.getCustomVersion());
|
tv_customversion.setText(JGYUtils.getCustomVersion());
|
||||||
tv_sn.setText("SN:" + Utils.getSerial());
|
tv_sn.setText("SN:" + Utils.getSerial());
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.uiui.sn.base;
|
package com.uiui.sn.base;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.media.AudioManager;
|
||||||
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -34,6 +37,21 @@ public class BaseApplication extends Application {
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
//非主进程不初始化
|
//非主进程不初始化
|
||||||
// if (SystemUtils.isMainProcessName(this, android.os.Process.myPid())) {
|
// if (SystemUtils.isMainProcessName(this, android.os.Process.myPid())) {
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
// ApkUtils.openApp(this, "com.android.settings");
|
||||||
|
//静音
|
||||||
|
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
int ringMax = audioManager.getStreamMinVolumeInt(AudioManager.STREAM_RING);
|
||||||
|
audioManager.setStreamVolume(AudioManager.STREAM_RING, ringMax, 0);
|
||||||
|
int musicMax = audioManager.getStreamMinVolumeInt(AudioManager.STREAM_MUSIC);
|
||||||
|
int voiceMax = audioManager.getStreamMinVolumeInt(AudioManager.STREAM_VOICE_CALL);
|
||||||
|
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, voiceMax, 0);
|
||||||
|
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, musicMax, 0); //音乐音量
|
||||||
|
Log.e(TAG, "debugTest: " + getExternalCacheDir());
|
||||||
|
Log.e(TAG, "debugTest: " + getExternalFilesDir("cache"));
|
||||||
|
Log.e(TAG, "debugTest: " + getCacheDir());
|
||||||
|
Log.e(TAG, "debugTest: " + Environment.getExternalStorageDirectory());
|
||||||
|
}
|
||||||
utilsInint();
|
utilsInint();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -457,7 +457,13 @@ public class CacheHelper {
|
|||||||
String cachePath;
|
String cachePath;
|
||||||
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|
||||||
|| !Environment.isExternalStorageRemovable()) {
|
|| !Environment.isExternalStorageRemovable()) {
|
||||||
cachePath = context.getExternalCacheDir().getPath();
|
if (context.getExternalCacheDir() != null) {
|
||||||
|
cachePath = context.getExternalCacheDir().getPath();
|
||||||
|
} else if (context.getExternalFilesDir("cache") != null) {
|
||||||
|
cachePath = context.getExternalFilesDir("cache").getPath();
|
||||||
|
} else {
|
||||||
|
cachePath = context.getCacheDir().getPath();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cachePath = context.getCacheDir().getPath();
|
cachePath = context.getCacheDir().getPath();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public class NetInterfaceManager {
|
|||||||
// builder.addNetworkInterceptor(mRequestInterceptor);
|
// builder.addNetworkInterceptor(mRequestInterceptor);
|
||||||
|
|
||||||
// 设置缓存文件路径
|
// 设置缓存文件路径
|
||||||
String cacheDirectory = mContext.getExternalCacheDir().getAbsolutePath() + "/OkHttpCache";
|
String cacheDirectory = getCacheDir() + "/OkHttpCache";
|
||||||
Cache cache = new Cache(new File(cacheDirectory), cacheSize);
|
Cache cache = new Cache(new File(cacheDirectory), cacheSize);
|
||||||
builder.cache(cache);// 设置缓存
|
builder.cache(cache);// 设置缓存
|
||||||
okHttpClient = builder.build();
|
okHttpClient = builder.build();
|
||||||
@@ -226,7 +226,27 @@ public class NetInterfaceManager {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getCacheDir() {
|
||||||
|
String cachePath;
|
||||||
|
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
|
||||||
|
|| !Environment.isExternalStorageRemovable()) {
|
||||||
|
if (mContext.getExternalCacheDir() != null) {
|
||||||
|
cachePath = mContext.getExternalCacheDir().getPath();
|
||||||
|
} else if (mContext.getExternalFilesDir("cache") != null) {
|
||||||
|
cachePath = mContext.getExternalFilesDir("cache").getPath();
|
||||||
|
} else {
|
||||||
|
cachePath = mContext.getCacheDir().getPath();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cachePath = mContext.getCacheDir().getPath();
|
||||||
|
}
|
||||||
|
return cachePath;
|
||||||
|
}
|
||||||
|
|
||||||
public static void init(Context context) {
|
public static void init(Context context) {
|
||||||
|
if (context == null) {
|
||||||
|
throw new RuntimeException("context is NULL");
|
||||||
|
}
|
||||||
if (INSTANCE == null) {
|
if (INSTANCE == null) {
|
||||||
INSTANCE = new NetInterfaceManager(context);
|
INSTANCE = new NetInterfaceManager(context);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user