2017-04-26 96 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作为临时解决方法,但也要将其报告给离您最近的三星服务中心。希望有足够的报告,他们可以快速部署修复它的操作系统更新