2017-04-26 94 views
2

我的手機正在生成一個不停的Log.d輸出。以下反覆重複約1200次/秒我搞砸了我的System_server服務嗎?

04-25 15:58:04.883 1542-5012/? D/NetworkStatsCollection: getHistory:mUID 10266 isVideoCallUID: false 

PID 1542是我已經瞭解的System_server管理一系列Android服務。在我正在開發的應用程序中,我使用瞭如下所示的Alarm Manager和Notification服務。有什麼我可以做的,使這項服務的反應是這樣嗎?

public void scheduleNotification(Context context, long alarmTime, int notificationId, String setOrCancel) { 
    EditText questionView = (EditText)findViewById(R.id.question); 
    String questionText = questionView.getText().toString(); 
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context) 
      .setContentTitle(context.getString(R.string.app_name)) 
      .setContentText(questionText) 
      .setAutoCancel(true) 
      .setSmallIcon(R.mipmap.ic_launcher) 
      .setLargeIcon(((BitmapDrawable) context.getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap()) 
      .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)); 

    Intent intent = new Intent(context, DashboardActivity.class); 
    PendingIntent activity = PendingIntent.getActivity(context, notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT); 
    builder.setContentIntent(activity); 

    Notification notification = builder.build(); 

    Intent notificationIntent = new Intent(context, TrackerNotificationService.class); 
    notificationIntent.putExtra(TrackerNotificationService.NOTIFICATION_ID, notificationId); 
    notificationIntent.putExtra(TrackerNotificationService.NOTIFICATION, notification); 
    PendingIntent pendingIntent = PendingIntent.getBroadcast(context, notificationId, 
      notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT); 

    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); 

    if (setOrCancel.equals("set")) { 
     alarmManager.set(AlarmManager.RTC_WAKEUP, alarmTime, pendingIntent); 
     Log.d("Check it", "scheduleNotification: " + alarmTime); 
    }else{ 
     alarmManager.cancel(pendingIntent); 
    } 

} 

TrackerNotificationService.java

import android.app.Notification; 
import android.app.NotificationManager; 
import android.content.BroadcastReceiver; 
import android.content.Context; 
import android.content.Intent; 

public class TrackerNotificationService extends BroadcastReceiver { 


    public static String NOTIFICATION_ID = "notification_id"; 
    public static String NOTIFICATION = "notification"; 

    @Override 
    public void onReceive(final Context context, Intent intent) { 

     NotificationManager notificationManager = (NotificationManager) 
       context.getSystemService(Context.NOTIFICATION_SERVICE); 

     Notification notification = intent.getParcelableExtra(NOTIFICATION); 
     int notificationId = intent.getIntExtra(NOTIFICATION_ID, 0); 
     notificationManager.notify(notificationId, notification); 
    } 
} 
+1

不要以爲它只是你,我在幾天前開始在我的Galaxy S7上看到這一點。 – dgmltn

回答

1

我有一個三星Galaxy S7邊緣,我已經注意到,NetworkStatsCollection垃圾郵件在我logcat的開始發生在我的設備上也是如此。

this所示,這似乎是一個核心操作系統進程。 設備製造商(在我的情況下,三星)必須在他們最新的操作系統更新做了一些修改,並留下一些調試。 非常討厭我必須補充。

使用this作爲臨時解決方法,但也要將其報告給離您最近的三星服務中心。希望有足夠的報告,他們可以快速部署修復它的操作系統更新