Commit a82fca8b by 刘鹏

feat: 1. 合规化整改,获取wifi、mac、imei等加入是否已同意隐私协议判断

parent 2ad2db39
......@@ -15,6 +15,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper
import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent
import com.ydl.audioim.YDLavManager
import com.ydl.component.music.FragmentContainerActivity
import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter
......@@ -34,6 +35,7 @@ import com.yidianling.muse.helper.MediaPlayerManager
import com.yidianling.muse.service.MeditationWindowService
import com.yidianling.tests.home.NewTestHomeActivity
import com.yidianling.user.StatusUtils
import com.yidianling.user.api.service.IUserService
import com.yidianling.user.ui.collect.CollectSexAndBirthActivity
import com.yidianling.user.ui.login.OneKeyLoginHelp
import com.yidianling.user.widget.SecretDescriptionDialog
......@@ -83,7 +85,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun initDataAndEvent() {
EventBus.getDefault().register(this)
//线上
// YDLavManager.instances.init(this, "3387e9b251f3491e9221a9877e8f7830")
//测试
YDLavManager.instances.init(this, "13b1536698f64905a1e7e5bb978ba821")
YdlCommonRouterManager.initYdlCommonRoute(PlatformTempCommonRouteImpl())
// 初始化一键登录sdk
......@@ -156,7 +161,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
startActivity(Intent(this, CollectSexAndBirthActivity::class.java))
}
bt_to_confide.setOnClickListener {
// YDLavManager.instances.login("1193016")
YDLavManager.instances.login(ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid)
startActivity(Intent(this, ConfideHomeActivity::class.java))
}
......
......@@ -137,7 +137,6 @@
android:id="@+id/bt_to_tests"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="测评" />
......
......@@ -36,7 +36,7 @@ ext {
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.33",
"ydl-platform" : "0.0.41.38",
//第二步 若干
"ydl-webview" : "0.0.38.92",
......@@ -124,7 +124,7 @@ ext {
//mdt 组件
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.33",
"ydl-platform" : "0.0.41.38",
//第二步 若干
"ydl-webview" : "0.0.38.92",
......
......@@ -702,9 +702,11 @@ class AudioHomeActivity :
if (iv_hands_free.isSelected) {
iv_hands_free.isSelected = false
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse)
hands_free_text.text="扬声器已关"
} else {
iv_hands_free.isSelected = true
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free)
hands_free_text.text="扬声器已开"
}
//已经接通
......@@ -1230,14 +1232,13 @@ class AudioHomeActivity :
phoneHandler?.removeCallbacksAndMessages(null)
//通知服务端,此次通话已经接通,服务端开始订单
updateExpertStatus(false, 0)
rl_mute_on_off.isClickable = true
//是否开启外放
voiceManage!!.getVoiceApi().setEnableSpeakerphone(false)
hands_free_text.text="扬声器已关"
iv_hands_free.isSelected = false
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse)
// if (waitDisposable != null) {
// waitDisposable!!.dispose()
// }
if (disposable != null) {
disposable!!.dispose()
}
......@@ -1274,6 +1275,8 @@ class AudioHomeActivity :
}, {
LogUtil.d(it.message)
}, {
leaveChannel()
uploadLog()
callEventSave("50", "倾诉时间已用完")
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "倾诉时间已用完")
......@@ -1430,7 +1433,6 @@ class AudioHomeActivity :
}
if (status == -1) {
tv_nte_status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null)
}
tv_nte_status.visibility = View.VISIBLE
tv_nte_status.postDelayed({
......
......@@ -326,53 +326,6 @@ class YDLavManager {
toUid: 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 @@
android:src="@drawable/audioim_img_hands_free_unuse" />
<TextView
android:id="@+id/hands_free_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hands_free"
android:layout_marginTop="8dp"
android:text="免提"
android:text="扬声器已关"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
......
......@@ -11,6 +11,7 @@ import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.ydl.ydlcommon.utils.DeviceTool;
import com.ydl.ydlcommon.utils.log.AliYunLogConfig;
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper;
import com.yidianling.avchatkit.common.log.LogUtil;
......@@ -543,6 +544,9 @@ public class NetworkUtil {
*/
public static String getActiveMacAddress(Context context) {
if (!DeviceTool.checkHasAgreeSecret()) {
return "";
}
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifi.getConnectionInfo();
......
......@@ -122,7 +122,9 @@ public class DeviceTool {
@SuppressLint("MissingPermission")
public static final String getIMEI() {
Activity topTaskActivity = ActivityManager.Companion.getInstance().getTopTaskActivity();
if (!checkHasAgreeSecret()) {
return "";
}
try {
String imei = "";
RxPermissions rxPermissions = new RxPermissions(topTaskActivity);
......@@ -147,9 +149,19 @@ public class DeviceTool {
}
}
/**
* 检查是否同意隐私协议
* */
public static boolean checkHasAgreeSecret() {
String hasAgreeSecret = SharedPreferencesEditor.getString("hasAgreeSecret");
return "true".equals(hasAgreeSecret);
}
public static String getEncryptionAndroidID() {
if (!checkHasAgreeSecret()) {
return "";
}
try {
@SuppressLint("HardwareIds") String id = Settings.Secure.getString(
RxTool.getContext().getContentResolver(),
......@@ -161,6 +173,9 @@ public class DeviceTool {
}
}
public static String getAndroidID() {
if (!checkHasAgreeSecret()) {
return "";
}
try {
@SuppressLint("HardwareIds") String id = Settings.Secure.getString(
RxTool.getContext().getContentResolver(),
......@@ -251,7 +266,9 @@ public class DeviceTool {
}
public static String getMac(Context context) {
if (!checkHasAgreeSecret()) {
return "02:00:00:00:00:00";
}
String strMac = null;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
......@@ -281,6 +298,9 @@ public class DeviceTool {
*GPRS链接和WIFI链接返回同一个MAC地址
* */
public static String getMacFromHardware() {
if (!checkHasAgreeSecret()) {
return "02:00:00:00:00:00";
}
try {
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) {
......@@ -328,6 +348,9 @@ public class DeviceTool {
* @return
*/
public static String getLocalWifiIpAddress(Context context) {
if (!checkHasAgreeSecret()) {
return "隐私协议未同意,不让获取";
}
try {
WifiManager wifiManager = (WifiManager) context
......@@ -343,6 +366,9 @@ public class DeviceTool {
//GPRS连接下的ip
public static String getLocalGPRSIpAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
NetworkInterface intf = en.nextElement();
......@@ -364,6 +390,9 @@ public class DeviceTool {
* @return
*/
public static String getNewMac() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) {
......@@ -390,6 +419,9 @@ public class DeviceTool {
return null;
}
public static String getLocalMacAddressFromWifiInfo(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo winfo = wifi.getConnectionInfo();
String mac = winfo.getMacAddress();
......@@ -400,6 +432,9 @@ public class DeviceTool {
* 获取IPV6地址
* */
public static String getLocalIpV6() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements(); ) {
......@@ -425,7 +460,9 @@ public class DeviceTool {
return null;
}
public static String getMacAddress(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
// 如果是6.0以下,直接通过wifimanager获取
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
String macAddress0 = getMacAddress0(context);
......@@ -465,6 +502,10 @@ public class DeviceTool {
}
private static String getMacAddress0(Context context) {
if (!checkHasAgreeSecret()) {
return null;
}
if (isAccessWifiStateAuthorized(context)) {
WifiManager wifiMgr = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
......@@ -494,8 +535,9 @@ public class DeviceTool {
Log.e("----->" + "NetInfoManager", "isAccessWifiStateAuthorized:"
+ "access wifi state is enabled");
return true;
} else
} else {
return false;
}
}
private static String loadFileAsString(String fileName) throws Exception {
......@@ -522,6 +564,9 @@ public class DeviceTool {
* @return
*/
public static String getMacAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
String strMacAddr = null;
try {
// 获得IpD地址
......@@ -547,6 +592,9 @@ public class DeviceTool {
* @return
*/
private static InetAddress getLocalInetAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
InetAddress ip = null;
try {
// 列举
......@@ -582,6 +630,9 @@ public class DeviceTool {
* @return
*/
public static String getLocalIpAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
try {
for (Enumeration<NetworkInterface> en = NetworkInterface
.getNetworkInterfaces(); en.hasMoreElements(); ) {
......@@ -601,6 +652,9 @@ public class DeviceTool {
}
public static String getMachineHardwareAddress() {
if (!checkHasAgreeSecret()) {
return null;
}
Enumeration<NetworkInterface> interfaces = null;
try {
interfaces = NetworkInterface.getNetworkInterfaces();
......@@ -646,6 +700,9 @@ public class DeviceTool {
}
public static String getLocalMacAddressFromBusybox() {
if (!checkHasAgreeSecret()) {
return "";
}
String result = "";
String Mac = "";
result = callCmd("busybox ifconfig", "HWaddr");
......
......@@ -434,6 +434,10 @@ class ActionCountUtils {
* @return
*/
fun getIpAddress(context: Context): String {
if (!DeviceTool.checkHasAgreeSecret()) {
return ""
}
// 获取WiFi服务
val wifiManager = context.getSystemService(Context.WIFI_SERVICE) as WifiManager
// 判断WiFi是否开启
......
......@@ -534,7 +534,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
if (params.getShare() != null) {
if (params.getShare().getType().equals("Meditation")){
if ("Meditation".equals(params.getShare().getType())){
shareUrl = params.getShare().getShare_url();
shareTitle = params.getShare().getTitle();
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