Music打开出错

本文详细阐述了如何通过在Android设备上添加一个模拟触摸屏驱动来解决某些应用程序因检测不到触摸设备资源而导致的崩溃问题。通过在内核中注册一个虚拟触摸屏设备,可以避免此类应用程序在没有实际触摸屏设备的情况下无法正常运行的情况。
 一打开就报错,类似“   

Android: android.content.res.Resources$NotFoundException: Resource ID #0x7f030009

 ”
google找到一篇: https://bugs.launchpad.net/linaro-android/+bug/772528

Ok I updated bug heading and here's a list of apps which crash:

* Contacts
* Music
* Phone (seems due to Contacts)

Stack traces below:

E/AndroidRuntime( 1452): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.contacts/com.android.contacts.DialtactsActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f03000e
E/AndroidRuntime( 1452): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 1452): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 1452): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 1452): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 1452): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1452): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 1452): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 1452): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1452): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1452): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 1452): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 1452): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1452): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f03000e
E/AndroidRuntime( 1452): at android.content.res.Resources.getValue(Resources.java:892)
E/AndroidRuntime( 1452): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
E/AndroidRuntime( 1452): at android.content.res.Resources.getLayout(Resources.java:731)
E/AndroidRuntime( 1452): at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
E/AndroidRuntime( 1452): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime( 1452): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
E/AndroidRuntime( 1452): at android.app.Activity.setContentView(Activity.java:1657)
E/AndroidRuntime( 1452): at com.android.contacts.DialtactsActivity.onCreate(DialtactsActivity.java:69)
E/AndroidRuntime( 1452): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 1452): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime( 1452): ... 11 more

E/AndroidRuntime( 1484): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.music/com.android.music.ArtistAlbumBrowserActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030009
E/AndroidRuntime( 1484): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 1484): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 1484): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 1484): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 1484)...

其中,网址:

http://git.linaro.org/gitweb?p=android/device/linaro/common.git;a=commitdiff;h=89a3940ca2ad04a54e4a8aa315f0089ce4621d17;hp=cc108a6396661b453085fd4be7011f69acf52d87

这里有个commit解决这个问题,是由于系统中没有touch设备,而Music需要检测系统中存在touch设备

才能工作。

From 89a3940ca2ad04a54e4a8aa315f0089ce4621d17 Mon Sep 17 00:00:00 2001
From: Jim Huang <jim.huang@linaro.org>
Date: Wed, 29 Jun 2011 01:22:52 +0800
Subject: [PATCH 1/1] [LINARO] Add fake touchscreen 'driver' to avoid Android activity crash

Some Android activities like 'Music' expect the presence of touchscreen
device, otherwise they would crash due to lacking of corresponding
system resources.

To fix the crash, a fake touchscreen 'driver' is added, which utilizes
uinput to register a touchscreen device in kernel.
---
 fake-ts/Android.mk |   30 ++++++++++++++++++++
 fake-ts/fake-ts.c  |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 fake-ts/Android.mk
 create mode 100644 fake-ts/fake-ts.c

diff --git a/fake-ts/Android.mk b/fake-ts/Android.mk
new file mode 100644
index 0000000..3c3ba4c
--- /dev/null
+++ b/fake-ts/Android.mk
@@ -0,0 +1,30 @@
+# Copyright (C) 2011 Linaro Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := faketsd
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := fake-ts.c
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_EXECUTABLE)
+
+endif # !TARGET_SIMULATOR
diff --git a/fake-ts/fake-ts.c b/fake-ts/fake-ts.c
new file mode 100644
index 0000000..9fe0a20
--- /dev/null
+++ b/fake-ts/fake-ts.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 Linaro Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <linux/uinput.h>
+
+/* look up source file system/core/init/devices.c for exact node */
+#define UINPUT_DEV "/dev/uinput"
+
+#define DEV_NAME "Fake Touchscreen"
+
+static int uinput_fd = 0;
+
+static void uinput_touch_init(const char* uinput_dev,
+                              const char* dev_name)
+{
+    struct uinput_user_dev dev;
+
+    uinput_fd = open(uinput_dev, O_WRONLY);
+    if (uinput_fd <= 0) {
+        perror("Error opening uinput device.\n");
+        return;
+    }
+    memset(&dev, 0, sizeof(dev));
+    strcpy(dev.name, dev_name);
+    write(uinput_fd, &dev, sizeof(dev));
+
+    /* touch screen event */
+    ioctl(uinput_fd, UI_SET_EVBIT, EV_ABS);
+    ioctl(uinput_fd, UI_SET_ABSBIT, ABS_X);
+    ioctl(uinput_fd, UI_SET_ABSBIT, ABS_Y);
+    ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY);
+    ioctl(uinput_fd, UI_SET_KEYBIT, BTN_TOUCH);
+
+    /* register userspace input device */
+    ioctl(uinput_fd, UI_DEV_CREATE, 0);
+}
+
+static void uinput_touch_deinit()
+{
+    if (uinput_fd > 0) {
+        close(uinput_fd);
+    }
+}
+
+int main(int argc, char* argv[])
+{
+    uinput_touch_init(UINPUT_DEV, DEV_NAME);
+
+    while (1) {
+        sleep(60);
+    }
+
+    uinput_touch_deinit();
+
+    return 0;
+}
+
-- 
1.7.0.4
或者简单点的办法,直接在kernel中选择一个touch的driver,哪怕用不到。


在CTF(Capture The Flag,夺旗赛)中,music.mp3文件可能包含多种隐藏信息,以下是一些常见的情况及分析方法: ### 音频隐写 - **基本原理**:音频隐写是将秘密信息隐藏在音频文件中而不影响音频的正常播放。常见的方法有最低有效位(LSB)隐写,通过修改音频采样值的最低几位来存储信息。 - **检测工具**:可以使用Stegsolve、Audacity等工具。以Audacity为例,它是一款开源的音频编辑软件,可以打开mp3文件,查看音频的波形图、频谱图等,通过分析这些图形可能发现隐藏的信息。 ```python # 这里只是示例代码,并非直接用于CTF中mp3隐写分析 import wave def read_audio(file_path): try: with wave.open(file_path, 'rb') as wf: params = wf.getparams() frames = wf.readframes(params.nframes) print(f"音频参数: {params}") return frames except Exception as e: print(f"读取音频文件出错: {e}") # 调用示例 audio_frames = read_audio('music.mp3') ``` ### 元数据信息 - **基本原理**:mp3文件包含一些元数据,如歌曲名称、艺术家、专辑等,这些元数据可能被出题者用来隐藏关键信息。 - **查看工具**:可以使用ExifTool等工具查看mp3文件的元数据。在命令行中,使用以下命令可以查看文件的详细元数据: ```bash exiftool music.mp3 ``` ### 频谱分析 - **基本原理**:音频的频谱图可以展示音频在不同频率上的能量分布。出题者可能会在频谱图中隐藏二维码、摩斯电码等信息。 - **分析工具**:Audacity同样可以用于频谱分析,打开mp3文件后,选择“分析” -> “频谱图”,通过调整频谱图的参数,可能发现隐藏的图案或字符。 ### 音频密码 - **基本原理**:音频文件可能包含某种形式的密码,如音频中的摩斯电码、音频密码本等。需要将音频中的声音转换为对应的字符或数字。 - **转换方法**:可以使用在线的摩斯电码转换器等工具,将音频中的摩斯电码转换为文本。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值