java.lang.RuntimeException: Error receiving broadcast Intent { act=android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED flg=0x40000010 bqHint=4 } in com.android.server.net.NetworkPolicyManagerService$4@bd55cc8

Appcelerator JIRA | Teun Klijn | 6 months ago
  1. 0

    Why does Android crash when I uninstall my Appcelerator application with module?

    Stack Overflow | 6 months ago | Teunozz
    java.lang.RuntimeException: Error receiving broadcast Intent { act=android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED flg=0x40000010 bqHint=4 } in com.android.server.net.NetworkPolicyManagerService$4@bd55cc8
  2. 0

    I've created a module for Titanium to send data from my app to my Android Wear application which works great. But when I uninstall the application Android crashes. I've checked Logcat but I don't see what the problem exactly is. Android only seems to crash if I uninstall the application right after calling module.sendData() (see example) Example: *index.js (app)* {code:javascript} function onOpen() { var module = require('teunozz.test.module') module.addEventListener('connected', function f() { console.log('send data'); module.sendData(); }); module.start(); } $.index.open(); {code} *index.xml (app)* {code:xml} <Alloy> <Window id="index" onOpen="onOpen"> </Window> </Alloy> {code} *AndroidWearClient (module)* {code:java} package teunozz.test.module; import org.appcelerator.titanium.TiApplication; import org.appcelerator.titanium.util.TiActivityResultHandler; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.wearable.DataApi; import com.google.android.gms.wearable.PutDataMapRequest; import com.google.android.gms.wearable.PutDataRequest; import com.google.android.gms.wearable.Wearable; public class AndroidWearClient extends Object implements TiActivityResultHandler, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private final static String TAG = "AndroidWearClient"; private static final int REQUEST_OAUTH = 1; private GoogleApiClient client = null; private TitestModule module = null; private boolean authInProgress = false; private void buildClient() { client = new GoogleApiClient.Builder( TiApplication.getAppCurrentActivity()) .addApi(Wearable.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); } public void start(TitestModule moduleArg) { module = moduleArg; buildClient(); client.connect(); } public void stop() { } public void onError(Activity activity, int requestCode, Exception e) { } public void onResult(Activity activity, int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_OAUTH) { authInProgress = false; if (resultCode == Activity.RESULT_OK) { if (!client.isConnecting() && !client.isConnected()) { client.connect(); } } } } public void onConnectionFailed(ConnectionResult result) { } public void onConnected(Bundle connectionHint) { // connected to Google Wearable API module.fireEvent("connected", null); } public void onConnectionSuspended(int cause) { } public void sendData() { // Construct a DataRequest and send over the data layer PutDataMapRequest putDMR = PutDataMapRequest.create("/test"); putDMR.getDataMap().putString("key", "test"); PutDataRequest request = putDMR.asPutDataRequest(); DataApi.DataItemResult result = // this is the problematic bit if you comment this out Android doesn't crash Wearable.DataApi.putDataItem(client, request).await(); if (result.getStatus().isSuccess()) { // Do something Log.e(TAG, "SUCCESS"); } else { // Do something } } } {code} *TitestModule (module)* {code:java} package teunozz.test.module; import teunozz.test.module.AndroidWearClient; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiApplication; import org.appcelerator.titanium.util.TiIntentWrapper; import org.appcelerator.kroll.common.Log; import org.appcelerator.kroll.common.TiConfig; import android.app.Activity; import android.content.Intent; @Kroll.module(name="Titest", id="teunozz.test.module") public class TitestModule extends KrollModule { // Standard Debugging variables private static final String LCAT = "TitestModule"; private static final boolean DBG = TiConfig.LOGD; private AndroidWearClient client = new AndroidWearClient(); // You can define constants with @Kroll.constant, for example: // @Kroll.constant public static final String EXTERNAL_NAME = value; public TitestModule() { super(); } @Kroll.onAppCreate public static void onAppCreate(TiApplication app) { // put module init code that needs to run when the application is created } @Override public void onDestroy(Activity activity) { client.stop(); } @Kroll.method public void start() { TiApplication appContext = TiApplication.getInstance(); Activity activity = appContext.getCurrentActivity(); client.start(this); } @Kroll.method public void stop() { client.stop(); } @Kroll.method public void sendData() { client.sendData(); } } {code} The basic module code and distribution is available on GitHub: https://github.com/Teunozz/titest This is the first error that I can find in Logcat. {code:java} 06-20 13:36:06.599: E/AndroidRuntime(14455): *** FATAL EXCEPTION IN SYSTEM PROCESS: NetworkPolicy 06-20 13:36:06.599: E/AndroidRuntime(14455): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED flg=0x40000010 bqHint=4 } in com.android.server.net.NetworkPolicyManagerService$4@bd55cc8 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1003) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.Handler.handleCallback(Handler.java:739) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.Handler.dispatchMessage(Handler.java:95) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.Looper.loop(Looper.java:158) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.HandlerThread.run(HandlerThread.java:61) 06-20 13:36:06.599: E/AndroidRuntime(14455): Caused by: java.lang.NullPointerException: Attempt to get length of null array 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService.isUidIdle(NetworkPolicyManagerService.java:3471) 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService.updateRuleForAppIdleLocked(NetworkPolicyManagerService.java:3397) 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService.updateRulesForTempWhitelistChangeLocked(NetworkPolicyManagerService.java:3451) 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService$4.onReceive(NetworkPolicyManagerService.java:731) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:993) 06-20 13:36:06.599: E/AndroidRuntime(14455): ... 4 more 06-20 13:36:06.659: E/android.os.Debug(14455): ro.product_ship = true 06-20 13:36:06.659: E/android.os.Debug(14455): ro.debug_level = 0x4f4c 06-20 13:36:06.659: E/android.os.Debug(14455): sys.mobilecare.preload = false ... {code} After this every service dies and Android restarts. {code:java} 06-20 13:36:07.049: I/ServiceManager(3046): service 'wifip2p' died 06-20 13:36:07.059: I/ServiceManager(3046): service 'package' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'user' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'activity' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'procstats' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'meminfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'gfxinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'dbinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'cpuinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'permission' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'processinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'sensorservice' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'lock_settings' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'mdm.remotedesktop' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'battery' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'usagestats' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'webviewupdate' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'scheduling_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'telephony.registry' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'persona' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'deviceidle' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'application_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'wifi_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'phone_restriction_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'remoteinjection' died ... {code}

    Appcelerator JIRA | 6 months ago | Teun Klijn
    java.lang.RuntimeException: Error receiving broadcast Intent { act=android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED flg=0x40000010 bqHint=4 } in com.android.server.net.NetworkPolicyManagerService$4@bd55cc8
  3. 0

    I've created a module for Titanium to send data from my app to my Android Wear application which works great. But when I uninstall the application Android crashes. I've checked Logcat but I don't see what the problem exactly is. Android only seems to crash if I uninstall the application right after calling module.sendData() (see example) Example: *index.js (app)* {code:javascript} function onOpen() { var module = require('teunozz.test.module') module.addEventListener('connected', function f() { console.log('send data'); module.sendData(); }); module.start(); } $.index.open(); {code} *index.xml (app)* {code:xml} <Alloy> <Window id="index" onOpen="onOpen"> </Window> </Alloy> {code} *AndroidWearClient (module)* {code:java} package teunozz.test.module; import org.appcelerator.titanium.TiApplication; import org.appcelerator.titanium.util.TiActivityResultHandler; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.wearable.DataApi; import com.google.android.gms.wearable.PutDataMapRequest; import com.google.android.gms.wearable.PutDataRequest; import com.google.android.gms.wearable.Wearable; public class AndroidWearClient extends Object implements TiActivityResultHandler, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private final static String TAG = "AndroidWearClient"; private static final int REQUEST_OAUTH = 1; private GoogleApiClient client = null; private TitestModule module = null; private boolean authInProgress = false; private void buildClient() { client = new GoogleApiClient.Builder( TiApplication.getAppCurrentActivity()) .addApi(Wearable.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); } public void start(TitestModule moduleArg) { module = moduleArg; buildClient(); client.connect(); } public void stop() { } public void onError(Activity activity, int requestCode, Exception e) { } public void onResult(Activity activity, int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_OAUTH) { authInProgress = false; if (resultCode == Activity.RESULT_OK) { if (!client.isConnecting() && !client.isConnected()) { client.connect(); } } } } public void onConnectionFailed(ConnectionResult result) { } public void onConnected(Bundle connectionHint) { // connected to Google Wearable API module.fireEvent("connected", null); } public void onConnectionSuspended(int cause) { } public void sendData() { // Construct a DataRequest and send over the data layer PutDataMapRequest putDMR = PutDataMapRequest.create("/test"); putDMR.getDataMap().putString("key", "test"); PutDataRequest request = putDMR.asPutDataRequest(); DataApi.DataItemResult result = // this is the problematic bit if you comment this out Android doesn't crash Wearable.DataApi.putDataItem(client, request).await(); if (result.getStatus().isSuccess()) { // Do something Log.e(TAG, "SUCCESS"); } else { // Do something } } } {code} *TitestModule (module)* {code:java} package teunozz.test.module; import teunozz.test.module.AndroidWearClient; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.titanium.TiApplication; import org.appcelerator.titanium.util.TiIntentWrapper; import org.appcelerator.kroll.common.Log; import org.appcelerator.kroll.common.TiConfig; import android.app.Activity; import android.content.Intent; @Kroll.module(name="Titest", id="teunozz.test.module") public class TitestModule extends KrollModule { // Standard Debugging variables private static final String LCAT = "TitestModule"; private static final boolean DBG = TiConfig.LOGD; private AndroidWearClient client = new AndroidWearClient(); // You can define constants with @Kroll.constant, for example: // @Kroll.constant public static final String EXTERNAL_NAME = value; public TitestModule() { super(); } @Kroll.onAppCreate public static void onAppCreate(TiApplication app) { // put module init code that needs to run when the application is created } @Override public void onDestroy(Activity activity) { client.stop(); } @Kroll.method public void start() { TiApplication appContext = TiApplication.getInstance(); Activity activity = appContext.getCurrentActivity(); client.start(this); } @Kroll.method public void stop() { client.stop(); } @Kroll.method public void sendData() { client.sendData(); } } {code} The basic module code and distribution is available on GitHub: https://github.com/Teunozz/titest This is the first error that I can find in Logcat. {code:java} 06-20 13:36:06.599: E/AndroidRuntime(14455): *** FATAL EXCEPTION IN SYSTEM PROCESS: NetworkPolicy 06-20 13:36:06.599: E/AndroidRuntime(14455): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED flg=0x40000010 bqHint=4 } in com.android.server.net.NetworkPolicyManagerService$4@bd55cc8 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1003) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.Handler.handleCallback(Handler.java:739) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.Handler.dispatchMessage(Handler.java:95) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.Looper.loop(Looper.java:158) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.os.HandlerThread.run(HandlerThread.java:61) 06-20 13:36:06.599: E/AndroidRuntime(14455): Caused by: java.lang.NullPointerException: Attempt to get length of null array 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService.isUidIdle(NetworkPolicyManagerService.java:3471) 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService.updateRuleForAppIdleLocked(NetworkPolicyManagerService.java:3397) 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService.updateRulesForTempWhitelistChangeLocked(NetworkPolicyManagerService.java:3451) 06-20 13:36:06.599: E/AndroidRuntime(14455): at com.android.server.net.NetworkPolicyManagerService$4.onReceive(NetworkPolicyManagerService.java:731) 06-20 13:36:06.599: E/AndroidRuntime(14455): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:993) 06-20 13:36:06.599: E/AndroidRuntime(14455): ... 4 more 06-20 13:36:06.659: E/android.os.Debug(14455): ro.product_ship = true 06-20 13:36:06.659: E/android.os.Debug(14455): ro.debug_level = 0x4f4c 06-20 13:36:06.659: E/android.os.Debug(14455): sys.mobilecare.preload = false ... {code} After this every service dies and Android restarts. {code:java} 06-20 13:36:07.049: I/ServiceManager(3046): service 'wifip2p' died 06-20 13:36:07.059: I/ServiceManager(3046): service 'package' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'user' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'activity' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'procstats' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'meminfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'gfxinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'dbinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'cpuinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'permission' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'processinfo' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'sensorservice' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'lock_settings' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'mdm.remotedesktop' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'battery' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'usagestats' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'webviewupdate' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'scheduling_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'telephony.registry' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'persona' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'deviceidle' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'application_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'wifi_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'phone_restriction_policy' died 06-20 13:36:07.069: I/ServiceManager(3046): service 'remoteinjection' died ... {code}

    Appcelerator JIRA | 6 months ago | Teun Klijn
    java.lang.RuntimeException: Error receiving broadcast Intent { act=android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED flg=0x40000010 bqHint=4 } in com.android.server.net.NetworkPolicyManagerService$4@bd55cc8
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    ListView crashes app

    Stack Overflow | 1 year ago | oblivion
    java.lang.RuntimeException: Unable to start activity ComponentInfo{antivirus.dc.lab.texttospeech/antivirus.dc.lab.texttospeech.MainActivity}: java.lang.NullPointerException: Attempt to get length of null array
  6. 0

    [BugReport] Attempt to get length of null array

    GitHub | 2 months ago | 920-Text-Editor-User
    java.lang.NullPointerException: Attempt to get length of null array

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to get length of null array

      at com.android.server.net.NetworkPolicyManagerService.isUidIdle()
    2. Android
      NetworkPolicyManagerService$4.onReceive
      1. com.android.server.net.NetworkPolicyManagerService.isUidIdle(NetworkPolicyManagerService.java:3471)
      2. com.android.server.net.NetworkPolicyManagerService.updateRuleForAppIdleLocked(NetworkPolicyManagerService.java:3397)
      3. com.android.server.net.NetworkPolicyManagerService.updateRulesForTempWhitelistChangeLocked(NetworkPolicyManagerService.java:3451)
      4. com.android.server.net.NetworkPolicyManagerService$4.onReceive(NetworkPolicyManagerService.java:731)
      4 frames
    3. Android Platform
      HandlerThread.run
      1. android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:993)
      2. android.os.Handler.handleCallback(Handler.java:739)
      3. android.os.Handler.dispatchMessage(Handler.java:95)
      4. android.os.Looper.loop(Looper.java:158)
      5. android.os.HandlerThread.run(HandlerThread.java:61)
      5 frames