【AndroidFramework】【EMMC拷机】混合拷机时盒子待机
作者:互联网
【AndroidFramework】【EMMC拷机】混合拷机时盒子待机
问题结论
暂时确定为误按键,不是故障。问题关闭。后续完全保证无按键(物理隔离)情况下如果出现待机,请反馈。
问题描述
【EMMC拷机】混合拷机时盒子待机---新版本引入
EMMC:东芝THGBMFG6C1LBAIL 容量为8GB
【故障描述】
1,拷机10台,全部杀了遥控器,拷机播放13H后发现一台出现问题
2,混合拷机时盒子待机
分析详细
- grep确认事件现场
- 确认日志产生机制
- 确认盒子待机按钮
- 确认自动待机接口
- 确认测试部“杀遥控器”方法
- grep确认事件现场
拿到日志有53份,每份102400k,先放在服务器上,grep一下,结果如下:
wanghongzhu@ubuntu:~/temp/182.16.90.24_2019-06-17-17-17-58$ grep 'sleep' * -nir
Log_2019-06-17-17-17-58_53.log:467677:2019-06-17 21:00:29.344 I/PowerManagerService( 3246): Going to sleep due to power button (uid 1000)...
Log_2019-06-17-17-17-58_53.log:467683:2019-06-17 21:00:29.344 I/PowerManagerService( 3246): Sleeping (uid 1000)...
Log_2019-06-17-17-17-58_53.log:481099:2019-06-17 21:00:32.464 I/TV_Client.TagTv( 4374): [4585][playermgr.cpp (L7160)][StopallTVplay]:---[0]---iPlayerID[0];joinchannel is NOT running!exit Sleep!
wanghongzhu@ubuntu:~/temp/182.16.90.24_2019-06-17-17-17-58$ grep 'screen off' * -nir
Log_2019-06-17-17-17-58_53.log:467687:2019-06-17 21:00:29.344 I/DisplayPowerController( 3246): Blocking screen off
Log_2019-06-17-17-17-58_53.log:467689:2019-06-17 21:00:29.344 I/DisplayPowerController( 3246): Unblocked screen off after 1 ms
Log_2019-06-17-17-17-58_53.log:468063:2019-06-17 21:00:29.547 D/PowerManagerService-JNI( 3246): Excessive delay in setInteractive(false) while turning screen off
结果显示,待机只发生在最后一份日志,并且显示为power button,结果基本明晰。接下来,
1.确认框架代码,什么情况下会出现该打印(遥控器按到了?其他未知原因调用到了?)
2.是不是碰到盒子上‘待机按钮’引起的
3.是不是什么apk调用了自动待机的接口?
- 确认日志产生机制
代码路径/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
/frameworks/base/services/core/java/com/android/server/power$ cat PowerManagerService.java |grep -nir 'Going to sleep due to'
PowerManagerService.java:1407: Slog.i(TAG, "Going to sleep due to device administration policy "
PowerManagerService.java:1411: Slog.i(TAG, "Going to sleep due to screen timeout (uid " + uid +")...");
PowerManagerService.java:1414: Slog.i(TAG, "Going to sleep due to lid switch (uid " + uid +")...");
PowerManagerService.java:1417: Slog.i(TAG, "Going to sleep due to power button (uid " + uid +")...");
PowerManagerService.java:1420: Slog.i(TAG, "Going to sleep due to sleep button (uid " + uid +")...");
PowerManagerService.java:1423: Slog.i(TAG, "Going to sleep due to HDMI standby (uid " + uid +")...");
跳转到打印处,调用的方法,梳理逻辑。
// This method is called goToSleep for historical reasons but we actually start
// dozing before really going to sleep.
@SuppressWarnings("deprecation")
private boolean goToSleepNoUpdateLocked(long eventTime, int reason, int flags, int uid) {
if (DEBUG_SPEW) {
Slog.d(TAG, "goToSleepNoUpdateLocked: eventTime=" + eventTime
+ ", reason=" + reason + ", flags=" + flags + ", uid=" + uid);
}
if (eventTime < mLastWakeTime
|| mWakefulness == WAKEFULNESS_ASLEEP
|| mWakefulness == WAKEFULNESS_DOZING
|| !mBootCompleted || !mSystemReady) {
return false;
}
Trace.traceBegin(Trace.TRACE_TAG_POWER, "goToSleep");
try {
switch (reason) {
case PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN:
Slog.i(TAG, "Going to sleep due to device administration policy "
+ "(uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_TIMEOUT:
Slog.i(TAG, "Going to sleep due to screen timeout (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_LID_SWITCH:
Slog.i(TAG, "Going to sleep due to lid switch (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON:
Slog.i(TAG, "Going to sleep due to power button (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON:
Slog.i(TAG, "Going to sleep due to sleep button (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_HDMI:
Slog.i(TAG, "Going to sleep due to HDMI standby (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_ACCESSIBILITY:
Slog.i(TAG, "Going to sleep by an accessibility service request (uid "
+ uid +")...");
break;
default:
Slog.i(TAG, "Going to sleep by application request (uid " + uid +")...");
reason = PowerManager.GO_TO_SLEEP_REASON_APPLICATION;
break;
}
mLastSleepTime = eventTime;
mSandmanSummoned = true;
setWakefulnessLocked(WAKEFULNESS_DOZING, reason);
// Report the number of wake locks that will be cleared by going to sleep.
int numWakeLocksCleared = 0;
final int numWakeLocks = mWakeLocks.size();
for (int i = 0; i < numWakeLocks; i++) {
final WakeLock wakeLock = mWakeLocks.get(i);
switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
case PowerManager.FULL_WAKE_LOCK:
case PowerManager.SCREEN_BRIGHT_WAKE_LOCK:
case PowerManager.SCREEN_DIM_WAKE_LOCK:
numWakeLocksCleared += 1;
break;
}
}
EventLogTags.writePowerSleepRequested(numWakeLocksCleared);
// Skip dozing if requested.
if ((flags & PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE) != 0) {
reallyGoToSleepNoUpdateLocked(eventTime, uid);
}
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
return true;
}
由以上代码可见,待机是由于power按键。不是由于某些应用程序调用。
确认盒子待机按钮
经按键盒子上的power键,是走的真待机重启流程,无以上打印。- 确认自动待机接口
做实验:设置中修改自动待机,过段时间待机后看日志。
实验结论:自动待机调用的接口与power button不同,该问题不是由调用自动待机接口导致。
日志如下:
sdcard/111.log |grep -nir 'sleep' <
(standard input):451:01-01 03:20:50.225 D/SharedPreferencesLogger( 5198): Tried to log string preference MainSettings/sleepTime = 10800000
(standard input):492:01-01 03:21:00.542 V/SettingsProvider( 3120): Notifying for 0: content://settings/secure/sleep_timeout
(standard input):494:01-01 03:21:00.549 D/SharedPreferencesLogger( 5198): Tried to log string preference MainSettings/sleepTime = 1800000
(standard input):1434:01-01 03:51:00.538 I/PowerManagerService( 3120): Going to sleep due to screen timeout (uid 1000)...
(standard input):1437:01-01 03:51:00.540 I/PowerManagerService( 3120): Sleeping (uid 1000)...
(standard input):1713:01-01 04:05:03.885 I/PowerManagerService( 3120): Waking up from sleep (uid=1000 reason=android.policy:POWER)...
- 确认测试部“杀遥控器”方法
经试验,在ATV9上无法屏蔽遥控器按键
标签:AndroidFramework,EMMC,17,TAG,sleep,待机,Going,拷机,uid 来源: https://www.cnblogs.com/houser0323/p/11063922.html