1

我正处于开发应用程序的最后阶段,今天当我从“睡眠”中恢复时,我的 Galaxy Nexus(运行 4.0.4)抛出了一条错误消息。电话已经闲置了大约一个小时左右。

不幸的是,我没有写下确切的错误消息,但我能够从 logcat 中提取以下内容。

我的应用程序有一个查看电话意图的 BroadcastReceiver,以及注册一些 ContentObservers 的服务。我在测试应用程序时没有收到错误消息。

有人可以查看 logcat 中的以下错误并帮助我确定我的应用程序是否会导致这些错误吗?

    2012-07-15 22:36:57.213 I 8661/ActivityManager: Start proc com.google.android.apps.uploader for broadcast com.google.android.apps.uploader/.ConnectivityBroadcastReceiver: pid=13497 uid=10035 gids={3003}
    2012-07-15 22:36:57.221 I 13497/dalvikvm: Turning on JNI app bug workarounds for target SDK version 11...        
    2012-07-15 22:36:57.245 I 13497/ActivityThread: Pub com.google.android.apps.uploader: com.google.android.apps.uploader.UploadsContentProvider
    2012-07-15 22:36:57.245 I 13497/ActivityThread: Pub com.google.photos.provider.Album: com.google.android.apps.uploader.clients.picasa.AlbumProvider
    2012-07-15 22:36:57.245 D 13497/MediaUploader: UploaderApplication.onCreate
    2012-07-15 22:36:57.260 D 13497/MediaUploader: nonWifiLimit=20971520, default=20971520
    2012-07-15 22:36:57.260 I 13497/MediaUploader: No need to wake up
    2012-07-15 22:36:57.268 D 9772/PicasaSyncManager: active network: NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true
    2012-07-15 22:36:57.268 D 9772/PicasaSyncManager: background data: true
    2012-07-15 22:36:57.268 I 8661/ActivityManager: No longer want com.android.voicedialer (pid 9435): hidden #16
    2012-07-15 22:36:57.291 I 13103/DMApp: Constructor()
    2012-07-15 22:36:57.291 I 13103/DMApp: onCreate...... 
    2012-07-15 22:36:57.315 I 13103/SyncmlService: onBind 
    2012-07-15 22:36:57.370 I 13497/MediaUploader: No need to wake up
    2012-07-15 22:36:57.370 D 9772/PicasaSyncManager: active network: NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true
    2012-07-15 22:36:57.370 D 9772/PicasaSyncManager: background data: true
    2012-07-15 22:36:57.682 D 8661/ConnectivityService: handleInetConditionHoldEnd: net=1, condition=100, published condition=100
    2012-07-15 22:36:59.166 D 8861/IMSFW: ImsSMSInterface$1: EVENT_DEREGISTER_DONE_TIMEOUT occured
    2012-07-15 22:36:59.174 D 8861/IMSFW: IIL: Instantiaing IIL 
    2012-07-15 22:36:59.174 D 8861/AndroidRuntime: Shutting down VM

    2012-07-15 22:36:59.174 W 8861/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40a4f1f8)
    2012-07-15 22:36:59.182 E 8861/AndroidRuntime: FATAL EXCEPTION: main
    android.content.ReceiverCallNotAllowedException: IntentReceiver components are not allowed to register to receive intents
    at android.app.ReceiverRestrictedContext.registerReceiver(ContextImpl.java:116)
    at android.app.ReceiverRestrictedContext.registerReceiver(ContextImpl.java:110)
    at com.sec.android.internal.ims.sms.SMS3GPP.smsrelaylayer.SmsRLInterface.<init>(SmsRLInterface.java:126)
    at com.sec.android.internal.ims.sms.SMS3GPP.smsrelaylayer.SmsRLInterface.getInstance(SmsRLInterface.java:86)
    at com.sec.android.internal.ims.sms.SMS3GPP.smsrelaylayer.RLMessageQueue.<init>(RLMessageQueue.java:65)
    at com.sec.android.internal.ims.sms.SMS3GPP.smsrelaylayer.RLMessageQueue.getInstance(RLMessageQueue.java:57)
    at com.sec.android.internal.ims.sms.SmsImsDispatcher.<init>(SmsImsDispatcher.java:77)
    at com.sec.android.internal.ims.sms.SmsImsDispatcher.getInstance(SmsImsDispatcher.java:85)
    at com.sec.android.internal.ims.sms.ImsSMSInterface.postIMSRegStatus(ImsSMSInterface.java:811)
    at com.sec.android.internal.ims.sms.ImsSMSInterface$1.handleMessage(ImsSMSInterface.java:287)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4424)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)

    2012-07-15 22:36:59.190 D 8861/IMSFW: IIL: Connected to '7467' socket
    2012-07-15 22:36:59.190 E 8861/IIL: Uncaught exception 
    java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
    at android.os.Handler.<init>(Handler.java:121)
    at com.sec.android.internal.ims.sms.SmsImsDispatcher.<init>(SmsImsDispatcher.java:64)
    at com.sec.android.internal.ims.sms.SmsImsDispatcher.getInstance(SmsImsDispatcher.java:85)
    at com.sec.android.ims.IIL.notifySocketConnection(IIL.java:316)
    at com.sec.android.ims.IIL.access$100(IIL.java:28)
    at com.sec.android.ims.IIL$IILReceiver.run(IIL.java:381)
    at java.lang.Thread.run(Thread.java:856)

编辑

这是我所有与Receivers 相关的代码。我从来没有真正打电话registerReceiver。为了验证,我在 Eclipse 中运行了一个 FileSearch 来寻找registerReceiver.

这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myproject" android:versionCode="1" android:versionName="1.0">
    <uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>

    <application android:icon="@drawable/ic_icon" android:label="@string/app_name" android:theme="@android:style/Theme.Light">
        <activity android:name=".CallListActivity"
                  android:label="@string/app_name" 
                  android:theme="@android:style/Theme.Light"
                  android:configChanges="orientation"
            android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>        

    <receiver android:name="MyPhoneReceiver">
        <intent-filter>
            <action android:name="android.intent.action.PHONE_STATE" />
            <action android:name="com.myproject.MY_ACTION" />
        </intent-filter>
    </receiver>
        <service android:name=".MyService" />
</manifest> 

这是我的服务:

public class MyService extends Service {

    private static MyContentObserver mContentObserver;
    private static ContactContentObserver mContactContentObserver;
    private Context mCtx;
    public int onStartCommand(Intent intent, int flags, int startId) {
        try {
            if(mContentObserver == null) {
                mContentObserver = new MyContentObserver();

                mCtx = this.getApplicationContext();
                mCtx.getContentResolver().registerContentObserver(CallLog.Calls.CONTENT_URI, true, mContentObserver);
            }

            mCtx = this.getApplicationContext();
            if(mContactContentObserver == null) {
                mContactContentObserver = new ContactContentObserver();
                this.getApplicationContext().getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, mContactContentObserver);
            }
        }
        catch (Exception e) {
        }
        return START_STICKY;
    }

        public IBinder onBind(Intent intent) {
        // We don't provide binding, so return null
        return null;
    }

    public void onPause() {
    }

    public void onDestroy() {
        try {
            if(mContentObserver != null)
                this.getApplicationContext().getContentResolver().unregisterContentObserver(mContentObserver);

            if(mContactContentObserver != null)
                this.getApplicationContext().getContentResolver().unregisterContentObserver(mContactContentObserver);
            super.onDestroy();
        }
        catch (Exception e) {
        }
    }

    private class MyContentObserver extends ContentObserver {
        public MyContentObserver() {
            super(null);

        }

            @Override
        public void onChange(boolean selfChange) {
            try {

                Intent intent = new Intent();
                intent.setAction("com.myproject.MY_ACTION");
                sendBroadcast(intent);
                super.onChange(selfChange);
            }
            catch (Exception e) { 
            }
        }
    }

    private class ContactContentObserver extends ContentObserver {
        public ContactContentObserver() {
            super(null);

        }

        @Override
        public void onChange(boolean selfChange) {

            super.onChange(selfChange);

            try {

                ContactUpdateTask updateContactsTask = new ContactUpdateTask(mCtx);
                updateContactsTask.execute(null);
            }
            catch (Exception e) { 
            }

        }


        private class ContactUpdateTask extends AsyncTask<Void, Void, Void> {
            private Context mCtx;

            private ContactUpdateTask(Context _ctx) {
                mCtx = _ctx;

            }
            protected Void doInBackground(Void... arg0) {
                try {

                 // DB stuff
            }
                catch (Exception e) { 
                }
                return null;

            }

            protected void onProgressUpdate(Void... arg0) {
                switch (mType) {
                }
            }

            protected void onPostExecute(Void arg0) {
                publishProgress((Void)null);

            }
        }
    }

}

这是我的广播接收器:

public class MyPhoneReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        try {
            Bundle extras = intent.getExtras();

            if (extras != null) { // Intent == android.intent.action.PHONE_STATE            

                //DB stuff
                if (something)
                    flag = false;
                else
                    flag = true;
            }
            else if (flag){
                try {
                    // DB Stuff
                }
                catch (Exception e) {
                }

                try {
                    // DB Stuff
                }
                catch (Exception e) {
                }
                Intent startActivity = new Intent();
                startActivity.setClass(context, NewActivity.class );
                startActivity.setAction(NewActivity.class.getName());
                startActivity.setFlags(
                        Intent.FLAG_ACTIVITY_NEW_TASK |
                        Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                context.startActivity(startActivity);

            }
        }
        catch (Exception e) {

        }

    }
}
4

1 回答 1

0

所以......事实证明,我无意中通过同时按下音量(向上和向下)和电源来创建调试报告。

当我不使用我的应用程序时,我已经开始关闭设备上的调试模式,并且报告已停止生成。

我很可能与我的应用程序无关的错误。

以下是 google 生成调试报告页面的链接:http: //support.google.com/mobile/bin/request.py ?&src=6279961&contact_type=android_bugreport

于 2012-08-05T14:04:07.583 回答