Skip to content

Commit

Permalink
video sdk合规,移除获取AndroidID的接口,使用UUID代替
Browse files Browse the repository at this point in the history
Change-Id: I6c978ba1841dbabdfcaece3a650eb9238e8fca61
  • Loading branch information
SundoggyNew committed Jan 3, 2024
1 parent adce182 commit 0a23ef3
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 22 deletions.
8 changes: 7 additions & 1 deletion app/src/main/java/com/tencent/iot/explorer/link/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class App : Application(), Application.ActivityLifecycleCallbacks, PayloadMessag
const val CONFIG = "config"
const val MUST_UPGRADE_TAG = "master"
var language: String? = ""
var uuid: String = ""

// 根据编译使用的 buildType 类型确定是否是 debug 版本
// 编译依赖的 buildType 包含 debug 字串即认为是 debug 版本
Expand Down Expand Up @@ -128,7 +129,12 @@ class App : Application(), Application.ActivityLifecycleCallbacks, PayloadMessag
override fun onCreate() {
super.onCreate()
MultiDex.install(this)
IoTAuth.setWebSocketTag(Utils.getAndroidID(this)) // 设置wss的uin
uuid = SharePreferenceUtil.getString(this, CONFIG, CommonField.UUID)
if (TextUtils.isEmpty(uuid)) {
SharePreferenceUtil.saveString(this, CONFIG, CommonField.UUID, UUID.randomUUID().toString())
uuid = SharePreferenceUtil.getString(this, CONFIG, CommonField.UUID)
}
IoTAuth.setWebSocketTag(uuid) // 设置wss的uin
IoTAuth.setWebSocketCallback(this) // 设置WebSocket连接状态回调
IoTAuth.init(BuildConfig.TencentIotLinkAppkey, BuildConfig.TencentIotLinkAppSecret)
//初始化弹框
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import androidx.constraintlayout.widget.ConstraintLayout;

import com.tencent.iot.explorer.link.App;
import com.tencent.iot.explorer.link.R;
import com.tencent.iot.explorer.link.T;
import com.tencent.iot.explorer.link.core.utils.Utils;
Expand All @@ -24,7 +25,7 @@ public class TipShareDevDialog extends IosCenterStyleDialog implements View.OnCl
private ConstraintLayout outsideLayout;
private ConstraintLayout dialogLayout;
private TextView moreInfo;
private String ANDROID_ID = Utils.INSTANCE.getAndroidID(T.getContext());
private String ANDROID_ID = App.Companion.getUuid();

public TipShareDevDialog(Context context) {
super(context, R.layout.popup_tip_share_dev_layout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import kotlinx.android.synthetic.main.menu_back_layout.*
*/
class AboutUsActivity : BaseActivity() {

private val ANDROID_ID = Utils.getAndroidID(T.getContext())
private val ANDROID_ID = App.uuid

override fun getContentView(): Int {
return R.layout.activity_about_us
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class BuleToothActivity: BaseActivity(), View.OnClickListener, MyCallback {
val ticketResponse = JSON.parse(response.data.toString()) as JSONObject
var url = H5_PANEL_BASE_URL +
"?productId=${productId}" +
"&uin=${Utils.getAndroidID(this)}" +
"&uin=${App.uuid}" +
"&lid=${App.data.appLifeCircleId}" +
"&quid=${Utils.getAndroidID(this)}" +
"&quid=${App.uuid}" +
"&ticket=${ticketResponse[CommonField.TOKEN_TICKET]}" +
"&appID=${T.getContext().applicationInfo.packageName}" +
"&platform=${HttpRequest.PLATFORM_TAG}" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.widget.LinearLayout
import android.widget.ProgressBar
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONObject
import com.tencent.iot.explorer.link.App
import com.tencent.iot.explorer.link.R
import com.tencent.iot.explorer.link.T
import com.tencent.iot.explorer.link.core.auth.callback.MyCallback
Expand Down Expand Up @@ -113,7 +114,7 @@ class CommentDetailsActivity: BaseActivity(), View.OnClickListener, MyCallback {
return
}
var js = JSON.parse(response.data.toString()) as JSONObject
var weburl = CommonField.H5_BASE_URL + "?uin=${Utils.getAndroidID(this)}#" +
var weburl = CommonField.H5_BASE_URL + "?uin=${App.uuid}#" +
pathUrl + "&ticket=${js[CommonField.TOKEN_TICKET]}" + "&lang=${Utils.getLang()}"
comment_detail_web.loadUrl(weburl)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class DevicePanelActivity: BaseActivity(), View.OnClickListener, MyCallback, App
var url = H5_PANEL_BASE_URL +
"?deviceId=${deviceEntity?.DeviceId}" +
"&familyId=${deviceEntity?.FamilyId}" +
"&uin=${Utils.getAndroidID(this)}" +
"&uin=${App.uuid}" +
"&roomId=${deviceEntity?.RoomId}" +
"&familyType=${App.data.getCurrentFamily().FamilyType}" +
"&lid=${App.data.appLifeCircleId}" +
"&quid=${Utils.getAndroidID(this)}" +
"&quid=${App.uuid}" +
"&ticket=${ticketResponse[CommonField.TOKEN_TICKET]}" +
"&appID=${T.getContext().applicationInfo.packageName}" +
"&platform=android" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.view.LayoutInflater
import android.view.View
import com.tencent.iot.explorer.link.App
import com.tencent.iot.explorer.link.R
import com.tencent.iot.explorer.link.core.log.L
import com.tencent.iot.explorer.link.kitlink.consts.SocketConstants
Expand All @@ -31,7 +32,7 @@ import kotlinx.android.synthetic.main.menu_back_layout.*
*/
class ForgotPasswordActivity : PActivity(), ForgotPasswordView, View.OnClickListener {

private val ANDROID_ID = Utils.getAndroidID(T.getContext())
private val ANDROID_ID = App.uuid
private lateinit var presenter: ForgotPasswordPresenter
private var forgotType = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class GuideActivity : PActivity(), View.OnClickListener{
if (hits[0] >= SystemClock.uptimeMillis() - duration) {
if (hits.size == 5) {
// 获取AndroidID,并保存至剪切板
Utils.copy(this, Utils.getAndroidID(T.getContext()))
Utils.copy(this, App.uuid)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class HelpWebViewActivity: BaseActivity(), MyCallback, View.OnClickListener {
var js = JSON.parse(response.data.toString()) as JSONObject
var url ="https://iot.cloud.tencent.com/explorer-h5/help-center/?" +
"&ticket=" + js[CommonField.TOKEN_TICKET]
url += "&uin=${Utils.getAndroidID(this)}"
url += "&uin=${App.uuid}"
if (!App.isOEMApp()) {
url += "&appID=" + T.getContext().applicationInfo.packageName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LogoutActivity : PActivity(), LogoutView, View.OnClickListener{

private lateinit var presenter: LogoutPresenter

private val ANDROID_ID = Utils.getAndroidID(T.getContext())
private val ANDROID_ID = App.uuid

override fun getPresenter(): IPresenter? {
return presenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RegisterActivity : PActivity(), RegisterView, View.OnClickListener {
private lateinit var phoneView: View
private lateinit var emailView: View

private val ANDROID_ID = Utils.getAndroidID(T.getContext())
private val ANDROID_ID = App.uuid

override fun getPresenter(): IPresenter? {
return presenter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class UserInfoActivity : PActivity(), UserInfoView, View.OnClickListener, View.O
if (hits[0] >= SystemClock.uptimeMillis() - duration) {
if (hits.size == 5) {
// 获取AndroidID,并保存至剪切板
Utils.copy(this, Utils.getAndroidID(T.getContext()))
Utils.copy(this, App.uuid)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class CommentFragment : BaseFragment(), View.OnClickListener, MyCallback {
if (response.code == 0) {
var js = JSON.parse(response.data.toString()) as JSONObject
var url = CommonField.H5_BASE_URL + "?ticket=" + js[CommonField.TOKEN_TICKET]
url += "&uin=${Utils.getAndroidID(context!!)}"
url += "&uin=${App.uuid}"
url += "&lang=${Utils.getLang()}"
if (!App.isOEMApp()) {
url += "&appID=" + T.getContext().applicationInfo.packageName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class HttpRequest private constructor() {
const val BUSI_APP = "studioapp"
const val BUSI_OPENSOURCE = "studioappOpensource"

val ANDROID_ID = Utils.getAndroidID(T.getContext())
val ANDROID_ID = App.uuid
val PLATFORM_TAG = "android"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ object Utils {
return context.resources.configuration.locale.language == "zh"
}

fun getAndroidID(context: Context): String {
val id = Settings.System.getString(context.contentResolver, Settings.System.ANDROID_ID)
return if (TextUtils.isEmpty(id)) ""
else id
}

fun bmpToByteArray(bitmap: Bitmap?): ByteArray? {

// 要返回的字符串
Expand Down

0 comments on commit 0a23ef3

Please sign in to comment.