Android 8 未写IMEI号时输入*#06*报错问题

— a/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/dialer/app/SpecialCharSequenceMgr.java
+++ b/vendor/mediatek/proprietary/packages/apps/Dialer/java/com/android/dialer/app/SpecialCharSequenceMgr.java
@@ -504,11 +504,11 @@ public class SpecialCharSequenceMgr {
*/
List imeiMeidIds = new ArrayList();
String imei1=telephonyManager.getDeviceId(0);

  •  String imei2=telephonyManager.getDeviceId(1);
    
  •  // String imei2=telephonyManager.getDeviceId(1);
     String meid=SystemProperties.get("gsm.mtk.meid");
     String meidTitle="MEID";
    
  •  imeiMeidIds.add(imei1);
    
  •  imeiMeidIds.add(imei2);
    
  •  imeiMeidIds.add(imei1 != null ? imei1 : "");
    
  •  // imeiMeidIds.add(imei2);
     imeiMeidIds.add(meidTitle);
     imeiMeidIds.add(meid);
     new AlertDialog.Builder(context)
    

@@ -524,6 +524,10 @@ public class SpecialCharSequenceMgr {
}

private static boolean handleRegulatoryInfoDisplay(Context context, String input) {

  •    if ("*#06#".equals(input)) {
    
  •  return true;
    
  • }
  • if (input.equals(MMI_REGULATORY_INFO_DISPLAY)) {
    LogUtil.i(
<template> <view class="bind-container"> <!-- 长者信息 --> <view class="section"> <text class="section-title">长者信息</text> <view class="info-row"> <text class="label">姓名:</text> <text class="value">{{ name }}</text> </view> <view class="info-row"> <text class="label">电话:</text> <text class="value">{{ phone }}</text> </view> </view> <!-- 设备绑定指引 --> <view class="section"> <text class="section-title">设备绑定</text> <view class="step">1、插入SIM卡:打开卡托,插入运营商SIM卡(确保SIM卡开通VoLTE功能)</view> <view class="step">2、开机:长按电源键开机</view> <view class="step">3、点击下方“扫一扫”按钮,扫描包装盒或设备上86或76开头的IMEI串码</view> </view> <!-- 扫一扫 --> <view class="scan-area" @click="scanCode"> <image src="/static/images/scan.png" class="scan-icon" mode="widthFix"></image> <text class="scan-text">扫一扫</text> </view> <view class="step1">多次扫码成功,请在下方手动输入IMEI串码</view> <!-- IMEI 输入框 --> <input class="imei-input" v-model="imei" placeholder="设备IMEI串码(15位数字)" type="text" maxlength="15" @input="onImeiInput" /> <!-- 绑定按钮 --> <button class="bind-btn" @click="handleBind" :disabled="!imei.trim()">绑定设备</button> <!-- H5 摄像头扫码弹窗(仅 H5 显示) --> <view v-if="showScanner" class="scanner-overlay" @click.stop="closeScanner"> <!-- 新增一个专门放 video 的容器 --> <view class="video-container"></view> <view class="scanner-box"> <view class="line"></view> </view> <view class="close-btn">×</view> </view> </view> </template> <script> import { bindDevice } from &#39;@/api/family&#39;; import { BrowserMultiFormatReader } from &#39;@zxing/library&#39;; export default { data() { return { id: &#39;&#39;, name: &#39;&#39;, phone: &#39;&#39;, imei: &#39;&#39;, showScanner: false, codeReader: null, isScanning: false }; }, onLoad(options) { this.id = options.id || &#39;&#39;; this.name = decodeURIComponent(options.name || &#39;&#39;); this.phone = options.phone || &#39;&#39;; }, methods: { scanCode() { // 判断是否为 App 或 小程序环境(有 plus 或 wx 对象) const isApp = typeof window !== &#39;undefined&#39; && (window.plus || window.__wxjs_environment); const isH5 = !isApp; if (isH5) { // ✅ 正确判断:只有 localhost / 127.0.0.1 允许 HTTP,其他 HTTP 都不行 const isLocalhost = [&#39;localhost&#39;, &#39;127.0.0.1&#39;].includes(location.hostname); const isSecure = location.protocol === &#39;https:&#39;; if (!isSecure && !isLocalhost) { uni.showToast({ title: &#39;请通过 HTTPS 或 localhost 访问以使用扫码功能&#39;, icon: &#39;none&#39;, duration: 3000 }); return; } // ✅ localhost 或 HTTPS 下,允许调用摄像头 this.startH5Scan(); } else { // App / 小程序:使用 uni.scanCode uni.scanCode({ onlyFromCamera: true, scanType: [&#39;qrCode&#39;, &#39;barCode&#39;], success: (res) => { const result = (res.result || &#39;&#39;).trim(); const imeiMatch = result.match(/\b\d{15}\b/); this.imei = imeiMatch ? imeiMatch[0] : result; }, fail: (err) => { console.warn(&#39;扫码失败:&#39;, err); uni.showToast({ title: &#39;扫码失败,请手动输入 IMEI&#39;, icon: &#39;none&#39; }); } }); } }, async startH5Scan() { if (this.isScanning) return; this.showScanner = true; this.isScanning = true; await this.$nextTick(); // 等待 DOM 渲染 let video = document.getElementById(&#39;qr-video&#39;); if (!video) { video = document.createElement(&#39;video&#39;); video.id = &#39;qr-video&#39;; video.setAttribute(&#39;autoplay&#39;, &#39;&#39;); video.setAttribute(&#39;playsinline&#39;, &#39;&#39;); video.style.width = &#39;100%&#39;; video.style.maxWidth = &#39;600px&#39;; video.style.display = &#39;block&#39;; video.style.background = &#39;#000&#39;; // ✅ 关键修改:查找 .video-container,而不是 .scanner-overlay const container = document.querySelector(&#39;.video-container&#39;); if (!container) { console.error(&#39;找到 .video-container&#39;); this.closeScanner(); return; } // 只清空 container 内的内容(防止重复插入) container.innerHTML = &#39;&#39;; container.appendChild(video); } this.codeReader = new BrowserMultiFormatReader(); try { const devices = await this.codeReader.getVideoInputDevices(); if (devices.length === 0) { throw new Error(&#39;检测到摄像头&#39;); } let deviceId = devices[0].deviceId; const backCam = devices.find(d => d.label.toLowerCase().includes(&#39;back&#39;)); if (backCam) deviceId = backCam.deviceId; this.codeReader.decodeFromVideoDevice( deviceId, &#39;qr-video&#39;, (result, err) => { if (result) { this.handleScanResult(result.getText()); } } ); } catch (err) { console.error(&#39;启动摄像头失败:&#39;, err); uni.showToast({ title: &#39;无法访问摄像头,请允许权限并使用 HTTPS&#39;, icon: &#39;none&#39; }); this.closeScanner(); } }, onImeiInput(e) { let val = e.detail.value; // 只保留数字 val = val.replace(/\D/g, &#39;&#39;); // 最多15位 if (val.length > 15) val = val.slice(0, 15); this.imei = val; // 确保最终值是干净的 }, handleScanResult(text) { if (!text) return; const raw = text.trim(); console.log(&#39;扫码结果:&#39;, raw); const matches = raw.match(/\d{15}/); if (matches) { this.imei = matches[0]; // 强制刷新输入框(可选) this.$nextTick(() => { // 如果需要,可以 focus 输入框 // 但 uni-app 不支持直接 focus H5 input,除非用 ref + $el }); } else { uni.showToast({ title: &#39;识别到15位 IMEI&#39;, icon: &#39;none&#39; }); } this.closeScanner(); }, closeScanner() { if (this.codeReader) { this.codeReader.reset(); this.codeReader = null; } this.isScanning = false; this.showScanner = false; // 确保 video 被移除 const video = document.getElementById(&#39;qr-video&#39;); if (video) video.remove(); // 关键:强制触发一次 DOM 更新(有 showScanner=false 不立即生效) this.$nextTick(); }, async handleBind() { const imei = this.imei.trim(); const studentId = this.id; if (!studentId) { uni.showToast({ title: &#39;长者信息异常&#39;, icon: &#39;none&#39; }); return; } if (!imei) { uni.showToast({ title: &#39;请输入或扫描 IMEI&#39;, icon: &#39;none&#39; }); return; } if (!/^\d{15}$/.test(imei)) { uni.showToast({ title: &#39;IMEI 应为15位数字&#39;, icon: &#39;none&#39; }); return; } try { uni.showLoading({ title: &#39;绑定中...&#39; }); const res = await bindDevice({ studentId: parseInt(studentId, 10), imei: imei }); uni.hideLoading(); if (res.errcode === 0) { uni.showToast({ title: &#39;绑定成功&#39;, icon: &#39;success&#39; }); setTimeout(() => uni.navigateBack(), 800); } else { uni.showToast({ title: res.errtext || &#39;绑定失败&#39;, icon: &#39;none&#39; }); } } catch (error) { uni.hideLoading(); console.error(&#39;绑定请求异常:&#39;, error); uni.showToast({ title: &#39;网络错误,请稍后再试&#39;, icon: &#39;none&#39; }); } } }, // 页面销毁清理资源 onUnload() { if (this.codeReader) { this.codeReader.reset(); } } }; </script> <style scoped> .bind-container { padding: 20rpx; } .section { background: #fff; border-radius: 12rpx; padding: 20rpx; margin-bottom: 20rpx; } .section-title { font-weight: bold; font-size: 32rpx; margin-bottom: 20rpx; display: block; } .info-row { display: flex; margin-bottom: 10rpx; } .label { color: #666; width: 120rpx; } .value { flex: 1; color: #333; } .step { font-size: 28rpx; color: #555; margin: 12rpx 0; line-height: 1.5; } .scan-area { background: #f0f7ff; border-radius: 16rpx; padding: 30rpx 0; text-align: center; margin: 30rpx 0; display: flex; flex-direction: column; /* 垂直排列 */ align-items: center; justify-content: center; } .scan-icon { width: 80rpx; height: 80rpx; margin-bottom: 10rpx; } .scan-text { font-size: 30rpx; color: #007AFF; } .step1 { font-size: 24rpx; color: #999; text-align: center; margin: 20rpx 0; } .imei-input { border: 1px solid #ddd; border-radius: 8rpx; padding: 20rpx; font-size: 28rpx; width: 100%; box-sizing: border-box; margin: 20rpx 0; } .bind-btn { background: #007AFF; color: white; border: none; border-radius: 8rpx; padding: 24rpx; font-size: 32rpx; width: 100%; } /* H5 扫码弹窗样式 */ .scanner-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; z-index: 9999; display: flex; justify-content: center; align-items: center; } .video-container { width: 100%; max-width: 600rpx; position: relative; /* 为 scanner-box 的 absolute 定位提供参考 */ } #qr-video { width: 100%; display: block; background: #000; } .scanner-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 300rpx; height: 300rpx; border: 2rpx solid rgba(0,255,0,0.5); box-shadow: 0 0 0 1000rpx rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; pointer-events: none; /* 防止遮挡点击事件 */ } .line { width: 200rpx; height: 4rpx; background: #0f0; animation: scanMove 2s infinite linear; } @keyframes scanMove { 0% { transform: translateY(-150rpx); } 100% { transform: translateY(150rpx); } } .close-btn { position: absolute; top: 40rpx; right: 40rpx; color: white; font-size: 60rpx; font-weight: bold; } </style>帮我搜索一下为什么不能手动输入
最新发布
11-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值