Program: 84855
Project: 84855
Buggy source:
private StatusBarPolicy(Context context,StatusBarService service){
  mContext=context;
  mService=service;
  mSignalStrength=new SignalStrength();
  mBatteryStats=BatteryStatsService.getService();
  mCalendar=Calendar.getInstance(TimeZone.getDefault());
  mClockData=IconData.makeText("String_Node_Str","String_Node_Str");
  mClockIcon=service.addIcon(mClockData,null);
  updateClock();
  ContentObserver coClock=new ContentObserver(null){
    @Override public void onChange(    boolean selfChange){
      updateClock();
    }
  }
;
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.COLOR_CLOCK),false,coClock);
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.DISPLAY_STATUS_BAR_CLOCK),false,coClock);
  mStorageManager=(StorageManager)context.getSystemService(Context.STORAGE_SERVICE);
  mStorageManager.registerListener(new com.android.server.status.StorageNotification(context));
  mBatteryData=IconData.makeIconNumber("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_battery_unknown,0,0);
  mBatteryIcon=service.addIcon(mBatteryData,null);
  ContentObserver coBattery=new ContentObserver(null){
    @Override public void onChange(    boolean selfChange){
      updateBattery(null);
    }
  }
;
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.COLOR_BATTERY_PERCENTAGE),false,coBattery);
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.DISPLAY_BATTERY_PERCENTAGE),false,coBattery);
  mPhone=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  mPhoneData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_signal_null,0,0);
  mPhoneIcon=service.addIcon(mPhoneData,null);
  ((TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE)).listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | PhoneStateListener.LISTEN_CALL_STATE| PhoneStateListener.LISTEN_DATA_CONNECTION_STATE| PhoneStateListener.LISTEN_DATA_ACTIVITY);
  mDataData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_data_connected_g,0,0);
  mDataIcon=service.addIcon(mDataData,null);
  service.setIconVisibility(mDataIcon,false);
  mWifiData=IconData.makeIcon("String_Node_Str",null,sWifiSignalImages[0],0,0);
  mWifiIcon=service.addIcon(mWifiData,null);
  service.setIconVisibility(mWifiIcon,false);
  mTTYModeEnableIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_tty_mode,0,0);
  mTTYModeIcon=service.addIcon(mTTYModeEnableIconData,null);
  service.setIconVisibility(mTTYModeIcon,false);
  mCdmaRoamingIndicatorIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_roaming_cdma_0,0,0);
  mCdmaRoamingIndicatorIcon=service.addIcon(mCdmaRoamingIndicatorIconData,null);
  service.setIconVisibility(mCdmaRoamingIndicatorIcon,false);
  mBluetoothData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_data_bluetooth,0,0);
  mBluetoothIcon=service.addIcon(mBluetoothData,null);
  BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  if (adapter != null) {
    mBluetoothEnabled=adapter.isEnabled();
  }
 else {
    mBluetoothEnabled=false;
  }
  mBluetoothA2dpConnected=false;
  mBluetoothHeadsetState=BluetoothHeadset.STATE_DISCONNECTED;
  mBluetoothPbapState=BluetoothPbap.STATE_DISCONNECTED;
  mService.setIconVisibility(mBluetoothIcon,mBluetoothEnabled);
  mGpsEnabledIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_gps_acquiring_anim,0,0);
  mGpsFixIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_gps_on,0,0);
  mGpsIcon=service.addIcon(mGpsEnabledIconData,null);
  service.setIconVisibility(mGpsIcon,false);
  mAlarmClockIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_notify_alarm,0,0);
  mAlarmClockIcon=service.addIcon(mAlarmClockIconData,null);
  service.setIconVisibility(mAlarmClockIcon,false);
  mSyncActiveIcon=service.addIcon(IconData.makeIcon("String_Node_Str",null,R.drawable.stat_notify_sync_anim0,0,0),null);
  mSyncFailingIcon=service.addIcon(IconData.makeIcon("String_Node_Str",null,R.drawable.stat_notify_sync_error,0,0),null);
  service.setIconVisibility(mSyncActiveIcon,false);
  service.setIconVisibility(mSyncFailingIcon,false);
  mVolumeData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_ringer_silent,0,0);
  mVolumeIcon=service.addIcon(mVolumeData,null);
  service.setIconVisibility(mVolumeIcon,false);
  updateVolume();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
  filter.addAction(Intent.ACTION_BATTERY_CHANGED);
  filter.addAction(Intent.ACTION_BATTERY_LOW);
  filter.addAction(Intent.ACTION_BATTERY_OKAY);
  filter.addAction(Intent.ACTION_POWER_CONNECTED);
  filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
  filter.addAction(Intent.ACTION_ALARM_CHANGED);
  filter.addAction(Intent.ACTION_SYNC_STATE_CHANGED);
  filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
  filter.addAction(AudioManager.VIBRATE_SETTING_CHANGED_ACTION);
  filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
  filter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  filter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  filter.addAction(BluetoothPbap.PBAP_STATE_CHANGED_ACTION);
  filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
  filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
  filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
  filter.addAction(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION);
  filter.addAction(GpsLocationProvider.GPS_FIX_CHANGE_ACTION);
  filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
  filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION);
  mContext.registerReceiver(mIntentReceiver,filter,null,mHandler);
  try {
    mHspaDataDistinguishable=mContext.getResources().getBoolean(com.android.internal.R.bool.config_hspa_data_distinguishable);
  }
 catch (  Exception e) {
    mHspaDataDistinguishable=false;
  }
}

Fixed version (ground truth):
private StatusBarPolicy(Context context,StatusBarService service){
  mContext=context;
  mService=service;
  mSignalStrength=new SignalStrength();
  mBatteryStats=BatteryStatsService.getService();
  mCalendar=Calendar.getInstance(TimeZone.getDefault());
  mClockData=IconData.makeText("String_Node_Str","String_Node_Str");
  mClockIcon=service.addIcon(mClockData,null);
  updateClock();
  ContentObserver coClock=new ContentObserver(null){
    @Override public void onChange(    boolean selfChange){
      updateClock();
    }
  }
;
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.COLOR_CLOCK),false,coClock);
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.DISPLAY_STATUS_BAR_CLOCK),false,coClock);
  mStorageManager=(StorageManager)context.getSystemService(Context.STORAGE_SERVICE);
  mStorageManager.registerListener(new com.android.server.status.StorageNotification(context));
  mBatteryData=IconData.makeIconNumber("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_battery_unknown,0,0);
  mBatteryIcon=service.addIcon(mBatteryData,null);
  ContentObserver coBattery=new ContentObserver(null){
    @Override public void onChange(    boolean selfChange){
      updateBattery();
    }
  }
;
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.COLOR_BATTERY_PERCENTAGE),false,coBattery);
  mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.DISPLAY_BATTERY_PERCENTAGE),false,coBattery);
  mPhone=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  mPhoneData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_signal_null,0,0);
  mPhoneIcon=service.addIcon(mPhoneData,null);
  ((TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE)).listen(mPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS | PhoneStateListener.LISTEN_CALL_STATE| PhoneStateListener.LISTEN_DATA_CONNECTION_STATE| PhoneStateListener.LISTEN_DATA_ACTIVITY);
  mDataData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_data_connected_g,0,0);
  mDataIcon=service.addIcon(mDataData,null);
  service.setIconVisibility(mDataIcon,false);
  mWifiData=IconData.makeIcon("String_Node_Str",null,sWifiSignalImages[0],0,0);
  mWifiIcon=service.addIcon(mWifiData,null);
  service.setIconVisibility(mWifiIcon,false);
  mTTYModeEnableIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_tty_mode,0,0);
  mTTYModeIcon=service.addIcon(mTTYModeEnableIconData,null);
  service.setIconVisibility(mTTYModeIcon,false);
  mCdmaRoamingIndicatorIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_roaming_cdma_0,0,0);
  mCdmaRoamingIndicatorIcon=service.addIcon(mCdmaRoamingIndicatorIconData,null);
  service.setIconVisibility(mCdmaRoamingIndicatorIcon,false);
  mBluetoothData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_data_bluetooth,0,0);
  mBluetoothIcon=service.addIcon(mBluetoothData,null);
  BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  if (adapter != null) {
    mBluetoothEnabled=adapter.isEnabled();
  }
 else {
    mBluetoothEnabled=false;
  }
  mBluetoothA2dpConnected=false;
  mBluetoothHeadsetState=BluetoothHeadset.STATE_DISCONNECTED;
  mBluetoothPbapState=BluetoothPbap.STATE_DISCONNECTED;
  mService.setIconVisibility(mBluetoothIcon,mBluetoothEnabled);
  mGpsEnabledIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_gps_acquiring_anim,0,0);
  mGpsFixIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_gps_on,0,0);
  mGpsIcon=service.addIcon(mGpsEnabledIconData,null);
  service.setIconVisibility(mGpsIcon,false);
  mAlarmClockIconData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_notify_alarm,0,0);
  mAlarmClockIcon=service.addIcon(mAlarmClockIconData,null);
  service.setIconVisibility(mAlarmClockIcon,false);
  mSyncActiveIcon=service.addIcon(IconData.makeIcon("String_Node_Str",null,R.drawable.stat_notify_sync_anim0,0,0),null);
  mSyncFailingIcon=service.addIcon(IconData.makeIcon("String_Node_Str",null,R.drawable.stat_notify_sync_error,0,0),null);
  service.setIconVisibility(mSyncActiveIcon,false);
  service.setIconVisibility(mSyncFailingIcon,false);
  mVolumeData=IconData.makeIcon("String_Node_Str",null,com.android.internal.R.drawable.stat_sys_ringer_silent,0,0);
  mVolumeIcon=service.addIcon(mVolumeData,null);
  service.setIconVisibility(mVolumeIcon,false);
  updateVolume();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
  filter.addAction(Intent.ACTION_BATTERY_CHANGED);
  filter.addAction(Intent.ACTION_BATTERY_LOW);
  filter.addAction(Intent.ACTION_BATTERY_OKAY);
  filter.addAction(Intent.ACTION_POWER_CONNECTED);
  filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
  filter.addAction(Intent.ACTION_ALARM_CHANGED);
  filter.addAction(Intent.ACTION_SYNC_STATE_CHANGED);
  filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
  filter.addAction(AudioManager.VIBRATE_SETTING_CHANGED_ACTION);
  filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
  filter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  filter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  filter.addAction(BluetoothPbap.PBAP_STATE_CHANGED_ACTION);
  filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
  filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
  filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
  filter.addAction(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION);
  filter.addAction(GpsLocationProvider.GPS_FIX_CHANGE_ACTION);
  filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
  filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION);
  mContext.registerReceiver(mIntentReceiver,filter,null,mHandler);
  try {
    mHspaDataDistinguishable=mContext.getResources().getBoolean(com.android.internal.R.bool.config_hspa_data_distinguishable);
  }
 catch (  Exception e) {
    mHspaDataDistinguishable=false;
  }
}