Commit cc7d274c by 刘鹏

Merge branch 'feat/lp/lp_4.3.97' into 'd/v4.3.97'

合规化获取设备信息控制

See merge request app_android_lib/YDL-Component!159
parents fe7fc7d7 72e6eea2
...@@ -15,6 +15,7 @@ import com.alibaba.android.arouter.launcher.ARouter ...@@ -15,6 +15,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ydl.audioim.YDLavManager
import com.ydl.component.music.FragmentContainerActivity import com.ydl.component.music.FragmentContainerActivity
import com.ydl.component.mvp.DemoContract import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter import com.ydl.component.mvp.DemoPresenter
...@@ -34,6 +35,7 @@ import com.yidianling.muse.helper.MediaPlayerManager ...@@ -34,6 +35,7 @@ import com.yidianling.muse.helper.MediaPlayerManager
import com.yidianling.muse.service.MeditationWindowService import com.yidianling.muse.service.MeditationWindowService
import com.yidianling.tests.home.NewTestHomeActivity import com.yidianling.tests.home.NewTestHomeActivity
import com.yidianling.user.StatusUtils import com.yidianling.user.StatusUtils
import com.yidianling.user.api.service.IUserService
import com.yidianling.user.ui.collect.CollectSexAndBirthActivity import com.yidianling.user.ui.collect.CollectSexAndBirthActivity
import com.yidianling.user.ui.login.OneKeyLoginHelp import com.yidianling.user.ui.login.OneKeyLoginHelp
import com.yidianling.user.widget.SecretDescriptionDialog import com.yidianling.user.widget.SecretDescriptionDialog
...@@ -83,7 +85,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -83,7 +85,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun initDataAndEvent() { override fun initDataAndEvent() {
EventBus.getDefault().register(this) EventBus.getDefault().register(this)
//线上
// YDLavManager.instances.init(this, "3387e9b251f3491e9221a9877e8f7830") // YDLavManager.instances.init(this, "3387e9b251f3491e9221a9877e8f7830")
//测试
YDLavManager.instances.init(this, "13b1536698f64905a1e7e5bb978ba821")
YdlCommonRouterManager.initYdlCommonRoute(PlatformTempCommonRouteImpl()) YdlCommonRouterManager.initYdlCommonRoute(PlatformTempCommonRouteImpl())
// 初始化一键登录sdk // 初始化一键登录sdk
...@@ -156,7 +161,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -156,7 +161,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
startActivity(Intent(this, CollectSexAndBirthActivity::class.java)) startActivity(Intent(this, CollectSexAndBirthActivity::class.java))
} }
bt_to_confide.setOnClickListener { bt_to_confide.setOnClickListener {
// YDLavManager.instances.login("1193016") YDLavManager.instances.login(ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid)
startActivity(Intent(this, ConfideHomeActivity::class.java)) startActivity(Intent(this, ConfideHomeActivity::class.java))
} }
......
...@@ -137,7 +137,6 @@ ...@@ -137,7 +137,6 @@
android:id="@+id/bt_to_tests" android:id="@+id/bt_to_tests"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:text="测评" /> android:text="测评" />
......
...@@ -5,7 +5,7 @@ ext { ...@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.50.24", "m-confide" : "0.0.50.25",
"m-consultant" : "0.0.60.67", "m-consultant" : "0.0.60.67",
"m-fm" : "0.0.30.09", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.48", "m-user" : "0.0.62.48",
...@@ -36,7 +36,7 @@ ext { ...@@ -36,7 +36,7 @@ ext {
"ydl-tuicore" : "0.0.23", "ydl-tuicore" : "0.0.23",
//第一步 //第一步
"ydl-platform" : "0.0.41.33", "ydl-platform" : "0.0.41.38",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.92", "ydl-webview" : "0.0.38.92",
...@@ -94,7 +94,7 @@ ext { ...@@ -94,7 +94,7 @@ ext {
ydlCompileVersion = [ ydlCompileVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.50.24", "m-confide" : "0.0.50.25",
"m-consultant" : "0.0.60.67", "m-consultant" : "0.0.60.67",
"m-fm" : "0.0.30.09", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.48", "m-user" : "0.0.62.48",
...@@ -124,7 +124,7 @@ ext { ...@@ -124,7 +124,7 @@ ext {
//mdt 组件 //mdt 组件
"ydl-tuicore" : "0.0.23", "ydl-tuicore" : "0.0.23",
//第一步 //第一步
"ydl-platform" : "0.0.41.33", "ydl-platform" : "0.0.41.38",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.92", "ydl-webview" : "0.0.38.92",
......
...@@ -701,9 +701,11 @@ class AudioHomeActivity : ...@@ -701,9 +701,11 @@ class AudioHomeActivity :
if (iv_hands_free.isSelected) { if (iv_hands_free.isSelected) {
iv_hands_free.isSelected = false iv_hands_free.isSelected = false
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse) iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse)
hands_free_text.text="扬声器已关"
} else { } else {
iv_hands_free.isSelected = true iv_hands_free.isSelected = true
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free) iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free)
hands_free_text.text="扬声器已开"
} }
//已经接通 //已经接通
...@@ -1229,14 +1231,13 @@ class AudioHomeActivity : ...@@ -1229,14 +1231,13 @@ class AudioHomeActivity :
phoneHandler?.removeCallbacksAndMessages(null) phoneHandler?.removeCallbacksAndMessages(null)
//通知服务端,此次通话已经接通,服务端开始订单 //通知服务端,此次通话已经接通,服务端开始订单
updateExpertStatus(false, 0) updateExpertStatus(false, 0)
rl_mute_on_off.isClickable = true
//是否开启外放 //是否开启外放
voiceManage!!.getVoiceApi().setEnableSpeakerphone(false) voiceManage!!.getVoiceApi().setEnableSpeakerphone(false)
hands_free_text.text="扬声器已关"
iv_hands_free.isSelected = false iv_hands_free.isSelected = false
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse) iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse)
// if (waitDisposable != null) {
// waitDisposable!!.dispose()
// }
if (disposable != null) { if (disposable != null) {
disposable!!.dispose() disposable!!.dispose()
} }
...@@ -1273,6 +1274,8 @@ class AudioHomeActivity : ...@@ -1273,6 +1274,8 @@ class AudioHomeActivity :
}, { }, {
LogUtil.d(it.message) LogUtil.d(it.message)
}, { }, {
leaveChannel()
uploadLog()
callEventSave("50", "倾诉时间已用完") callEventSave("50", "倾诉时间已用完")
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "倾诉时间已用完") YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "倾诉时间已用完")
...@@ -1429,7 +1432,6 @@ class AudioHomeActivity : ...@@ -1429,7 +1432,6 @@ class AudioHomeActivity :
} }
if (status == -1) { if (status == -1) {
tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null) tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null)
} }
tv_nte_status.visibility = View.VISIBLE tv_nte_status.visibility = View.VISIBLE
tv_nte_status.postDelayed({ tv_nte_status.postDelayed({
......
...@@ -324,53 +324,6 @@ class YDLavManager { ...@@ -324,53 +324,6 @@ class YDLavManager {
toUid: String, toUid: String,
content: String content: String
) { ) {
// LogUtil.e("[agora]收到云信的通知消息:$content")
// val agoraInvitationBean = Gson().fromJson(content, AgoraInvitationBean::class.java)
//1发起呼叫 2接受呼叫 3取消呼叫 4拒绝呼叫邀请 5呼叫超时
// when (agoraInvitationBean.callType) {
// "1" -> {
// writeAgoraLog("1收到云信消息通知电话-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// receivedCall(agoraInvitationBean.data, "来自云信")
// }
// "2" -> {
// writeAgoraLog("对方接受了通话邀请,主叫开始加入频道:callType${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
// FILE_NAME
// )
// val act = ActivityManager.getInstance().getTopTaskActivity()
// if (act is AudioHomeActivity) {
// act.runOnUiThread {
// act.joinChannel()
// }
// }
// }
// "3" -> {
// writeAgoraLog("呼叫邀请被取消:主叫主动取消-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// closePage()
// }
// "4" -> {
// writeAgoraLog("被叫拒绝了通话邀请-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// val act = ActivityManager.getInstance().getTopTaskActivity()
// if (act is AudioHomeActivity) {
// act.runOnUiThread {
// ToastUtil.toastShort("对方已挂断")
// //通话结束或挂断时,上传日志文件
// act.uploadLog()
// act.leaveChannel()
// }
// }
// }
// "5" -> {
// writeAgoraLog("呼叫邀请被取消:呼叫邀请过期-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// //关闭页面
// closePage()
// }
// else -> {
// writeAgoraLog("其它AgoraInvitationBean,${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// }
// }
} }
}) })
} }
......
...@@ -302,11 +302,12 @@ ...@@ -302,11 +302,12 @@
android:src="@drawable/audioim_img_hands_free_unuse" /> android:src="@drawable/audioim_img_hands_free_unuse" />
<TextView <TextView
android:id="@+id/hands_free_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/iv_hands_free" android:layout_below="@+id/iv_hands_free"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="免提" android:text="扬声器已关"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
......
...@@ -31,6 +31,7 @@ import com.ydl.confide.home.event.ConfideDialogEvent ...@@ -31,6 +31,7 @@ import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.confide.home.http.ConfideHomeApi import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.confide.router.PhoneCallIn import com.ydl.confide.router.PhoneCallIn
import com.ydl.utils.WebUrlParamsUtils import com.ydl.utils.WebUrlParamsUtils
import com.ydl.webview.IJavascriptHandler
import com.ydl.webview.ProgressWebView import com.ydl.webview.ProgressWebView
import com.ydl.webview.TellData import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils import com.ydl.webview.WebModularServiceUtils
...@@ -42,6 +43,7 @@ import com.ydl.ydlnet.YDLHttpUtils ...@@ -42,6 +43,7 @@ import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.event.UserLoginEvent
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
...@@ -75,7 +77,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -75,7 +77,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
lateinit var layoutBottom: View lateinit var layoutBottom: View
lateinit var itemView: View lateinit var itemView: View
var bottomSheet :FrameLayout?=null var bottomSheet :FrameLayout?=null
var mJtoJHandle:IJavascriptHandler?=null
private var behavior: BottomSheetBehavior<*>? = null private var behavior: BottomSheetBehavior<*>? = null
...@@ -345,14 +347,13 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -345,14 +347,13 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
setting.setAllowFileAccess(true) setting.setAllowFileAccess(true)
setting.setBlockNetworkImage(false) setting.setBlockNetworkImage(false)
wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上 wv_content?.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
val jtoJHandle = WebModularServiceUtils.getWebService() mJtoJHandle = WebModularServiceUtils.getWebService()
.getJavascripHandler(requireActivity(), tellData = TellData()) .getJavascripHandler(requireActivity(), tellData = TellData())
wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler") wv_content?.addJavascriptInterface(mJtoJHandle, "javascriptHandler")
// var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1" // var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1"
val url = WebUrlParamsUtils.getSuffix(jumpUrl, jtoJHandle.getUriAppendSuffix()) loadUrl()
wv_content.loadUrl(url)
// wv_content.loadUrl(jumpUrl) // wv_content.loadUrl(jumpUrl)
wv_content.setOnTouchListener { p0, p1 -> //canScrollVertically(-1)的值表示是否能向下滚动,false表示已经滚动到顶部 wv_content.setOnTouchListener { p0, p1 -> //canScrollVertically(-1)的值表示是否能向下滚动,false表示已经滚动到顶部
...@@ -418,6 +419,11 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -418,6 +419,11 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
} }
} }
private fun loadUrl() {
val url = WebUrlParamsUtils.getSuffix(jumpUrl, mJtoJHandle?.getUriAppendSuffix())
wv_content?.loadUrl(url)
}
private fun shouldOverridePayUrl(view: WebView, url: String): Boolean { private fun shouldOverridePayUrl(view: WebView, url: String): Boolean {
if (url.startsWith("weixin://")) { if (url.startsWith("weixin://")) {
return try { return try {
...@@ -574,4 +580,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -574,4 +580,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
wv_content.destroy() wv_content.destroy()
EventBus.getDefault().unregister(this) EventBus.getDefault().unregister(this)
} }
fun onEvent(event: UserLoginEvent) {
loadUrl()
}
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import android.os.Build; ...@@ -11,6 +11,7 @@ import android.os.Build;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import com.ydl.ydlcommon.utils.DeviceTool;
import com.ydl.ydlcommon.utils.log.AliYunLogConfig; import com.ydl.ydlcommon.utils.log.AliYunLogConfig;
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper; import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper;
import com.yidianling.avchatkit.common.log.LogUtil; import com.yidianling.avchatkit.common.log.LogUtil;
...@@ -543,6 +544,9 @@ public class NetworkUtil { ...@@ -543,6 +544,9 @@ public class NetworkUtil {
*/ */
public static String getActiveMacAddress(Context context) { public static String getActiveMacAddress(Context context) {
if (!DeviceTool.checkHasAgreeSecret()) {
return "";
}
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifi.getConnectionInfo(); WifiInfo info = wifi.getConnectionInfo();
......
...@@ -122,7 +122,9 @@ public class DeviceTool { ...@@ -122,7 +122,9 @@ public class DeviceTool {
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
public static final String getIMEI() { public static final String getIMEI() {
Activity topTaskActivity = ActivityManager.Companion.getInstance().getTopTaskActivity(); Activity topTaskActivity = ActivityManager.Companion.getInstance().getTopTaskActivity();
if (!checkHasAgreeSecret()) {
return "";
}
try { try {
String imei = ""; String imei = "";
RxPermissions rxPermissions = new RxPermissions(topTaskActivity); RxPermissions rxPermissions = new RxPermissions(topTaskActivity);
...@@ -147,9 +149,19 @@ public class DeviceTool { ...@@ -147,9 +149,19 @@ public class DeviceTool {
} }
} }
/**
* 检查是否同意隐私协议
* */
public static boolean checkHasAgreeSecret() {
String hasAgreeSecret = SharedPreferencesEditor.getString("hasAgreeSecret");
return "true".equals(hasAgreeSecret);
}
public static String getEncryptionAndroidID() { public static String getEncryptionAndroidID() {
if (!checkHasAgreeSecret()) {
return "";
}
try { try {
@SuppressLint("HardwareIds") String id = Settings.Secure.getString( @SuppressLint("HardwareIds") String id = Settings.Secure.getString(
RxTool.getContext().getContentResolver(), RxTool.getContext().getContentResolver(),
...@@ -161,6 +173,9 @@ public class DeviceTool { ...@@ -161,6 +173,9 @@ public class DeviceTool {
} }
} }
public static String getAndroidID() { public static String getAndroidID() {
if (!checkHasAgreeSecret()) {
return "";
}
try { try {
@SuppressLint("HardwareIds") String id = Settings.Secure.getString( @SuppressLint("HardwareIds") String id = Settings.Secure.getString(
RxTool.getContext().getContentResolver(), RxTool.getContext().getContentResolver(),
...@@ -251,7 +266,9 @@ public class DeviceTool { ...@@ -251,7 +266,9 @@ public class DeviceTool {
} }
public static String getMac(Context context) { public static String getMac(Context context) {
if (!checkHasAgreeSecret()) {
return "02:00:00:00:00:00";
}
String strMac = null; String strMac = null;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
...@@ -281,6 +298,9 @@ public class DeviceTool { ...@@ -281,6 +298,9 @@ public class DeviceTool {
*GPRS链接和WIFI链接返回同一个MAC地址 *GPRS链接和WIFI链接返回同一个MAC地址
* */ * */
public static String getMacFromHardware() { public static String getMacFromHardware() {
if (!checkHasAgreeSecret()) {
return "02:00:00:00:00:00";
}
try { try {
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces()); List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) { for (NetworkInterface nif : all) {
...@@ -328,6 +348,9 @@ public class DeviceTool { ...@@ -328,6 +348,9 @@ public class DeviceTool {
* @return * @return
*/ */
public static String getLocalWifiIpAddress(Context context) { public static String getLocalWifiIpAddress(Context context) {
if (!checkHasAgreeSecret()) {
return "隐私协议未同意,不让获取";
}
try { try {
WifiManager wifiManager = (WifiManager) context WifiManager wifiManager = (WifiManager) context
...@@ -343,6 +366,9 @@ public class DeviceTool { ...@@ -343,6 +366,9 @@ public class DeviceTool {
//GPRS连接下的ip //GPRS连接下的ip
public static String getLocalGPRSIpAddress() { public static String getLocalGPRSIpAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
try { try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
NetworkInterface intf = en.nextElement(); NetworkInterface intf = en.nextElement();
...@@ -364,6 +390,9 @@ public class DeviceTool { ...@@ -364,6 +390,9 @@ public class DeviceTool {
* @return * @return
*/ */
public static String getNewMac() { public static String getNewMac() {
if (!checkHasAgreeSecret()) {
return null;
}
try { try {
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces()); List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) { for (NetworkInterface nif : all) {
...@@ -390,6 +419,9 @@ public class DeviceTool { ...@@ -390,6 +419,9 @@ public class DeviceTool {
return null; return null;
} }
public static String getLocalMacAddressFromWifiInfo(Context context) { public static String getLocalMacAddressFromWifiInfo(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo winfo = wifi.getConnectionInfo(); WifiInfo winfo = wifi.getConnectionInfo();
String mac = winfo.getMacAddress(); String mac = winfo.getMacAddress();
...@@ -400,6 +432,9 @@ public class DeviceTool { ...@@ -400,6 +432,9 @@ public class DeviceTool {
* 获取IPV6地址 * 获取IPV6地址
* */ * */
public static String getLocalIpV6() { public static String getLocalIpV6() {
if (!checkHasAgreeSecret()) {
return null;
}
try { try {
for (Enumeration<NetworkInterface> en = NetworkInterface for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements(); ) { .getNetworkInterfaces(); en.hasMoreElements(); ) {
...@@ -425,7 +460,9 @@ public class DeviceTool { ...@@ -425,7 +460,9 @@ public class DeviceTool {
return null; return null;
} }
public static String getMacAddress(Context context) { public static String getMacAddress(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
// 如果是6.0以下,直接通过wifimanager获取 // 如果是6.0以下,直接通过wifimanager获取
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
String macAddress0 = getMacAddress0(context); String macAddress0 = getMacAddress0(context);
...@@ -465,6 +502,10 @@ public class DeviceTool { ...@@ -465,6 +502,10 @@ public class DeviceTool {
} }
private static String getMacAddress0(Context context) { private static String getMacAddress0(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
if (isAccessWifiStateAuthorized(context)) { if (isAccessWifiStateAuthorized(context)) {
WifiManager wifiMgr = (WifiManager) context WifiManager wifiMgr = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE); .getSystemService(Context.WIFI_SERVICE);
...@@ -494,8 +535,9 @@ public class DeviceTool { ...@@ -494,8 +535,9 @@ public class DeviceTool {
Log.e("----->" + "NetInfoManager", "isAccessWifiStateAuthorized:" Log.e("----->" + "NetInfoManager", "isAccessWifiStateAuthorized:"
+ "access wifi state is enabled"); + "access wifi state is enabled");
return true; return true;
} else } else {
return false; return false;
}
} }
private static String loadFileAsString(String fileName) throws Exception { private static String loadFileAsString(String fileName) throws Exception {
...@@ -522,6 +564,9 @@ public class DeviceTool { ...@@ -522,6 +564,9 @@ public class DeviceTool {
* @return * @return
*/ */
public static String getMacAddress() { public static String getMacAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
String strMacAddr = null; String strMacAddr = null;
try { try {
// 获得IpD地址 // 获得IpD地址
...@@ -547,6 +592,9 @@ public class DeviceTool { ...@@ -547,6 +592,9 @@ public class DeviceTool {
* @return * @return
*/ */
private static InetAddress getLocalInetAddress() { private static InetAddress getLocalInetAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
InetAddress ip = null; InetAddress ip = null;
try { try {
// 列举 // 列举
...@@ -582,6 +630,9 @@ public class DeviceTool { ...@@ -582,6 +630,9 @@ public class DeviceTool {
* @return * @return
*/ */
public static String getLocalIpAddress() { public static String getLocalIpAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
try { try {
for (Enumeration<NetworkInterface> en = NetworkInterface for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements(); ) { .getNetworkInterfaces(); en.hasMoreElements(); ) {
...@@ -601,6 +652,9 @@ public class DeviceTool { ...@@ -601,6 +652,9 @@ public class DeviceTool {
} }
public static String getMachineHardwareAddress() { public static String getMachineHardwareAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
Enumeration<NetworkInterface> interfaces = null; Enumeration<NetworkInterface> interfaces = null;
try { try {
interfaces = NetworkInterface.getNetworkInterfaces(); interfaces = NetworkInterface.getNetworkInterfaces();
...@@ -646,6 +700,9 @@ public class DeviceTool { ...@@ -646,6 +700,9 @@ public class DeviceTool {
} }
public static String getLocalMacAddressFromBusybox() { public static String getLocalMacAddressFromBusybox() {
if (!checkHasAgreeSecret()) {
return "";
}
String result = ""; String result = "";
String Mac = ""; String Mac = "";
result = callCmd("busybox ifconfig", "HWaddr"); result = callCmd("busybox ifconfig", "HWaddr");
......
...@@ -434,6 +434,10 @@ class ActionCountUtils { ...@@ -434,6 +434,10 @@ class ActionCountUtils {
* @return * @return
*/ */
fun getIpAddress(context: Context): String { fun getIpAddress(context: Context): String {
if (!DeviceTool.checkHasAgreeSecret()) {
return ""
}
// 获取WiFi服务 // 获取WiFi服务
val wifiManager = context.getSystemService(Context.WIFI_SERVICE) as WifiManager val wifiManager = context.getSystemService(Context.WIFI_SERVICE) as WifiManager
// 判断WiFi是否开启 // 判断WiFi是否开启
......
...@@ -532,7 +532,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -532,7 +532,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
public void openShareMenu(H5JsBean.H5JsCmd.Params params) { public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
if (params.getShare() != null) { if (params.getShare() != null) {
if (params.getShare().getType().equals("Meditation")){ if ("Meditation".equals(params.getShare().getType())){
shareUrl = params.getShare().getShare_url(); shareUrl = params.getShare().getShare_url();
shareTitle = params.getShare().getTitle(); shareTitle = params.getShare().getTitle();
shareDesc = params.getShare().getDesc(); shareDesc = params.getShare().getDesc();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment