Buggy code:
class GlobalActions implements DialogInterface . OnClickListener , DialogInterface . OnDismissListener { private static final String TAG = "GlobalActions" ; private static final boolean SHOW_SILENT_TOGGLE = true ; private static final String GLOBAL_ACTION_KEY_POWER = "power" ; private static final String GLOBAL_ACTION_KEY_REBOOT = "reboot" ; private static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot" ; private static final String GLOBAL_ACTION_KEY_SCREENRECORD = "screenrecord" ; private static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane" ; private static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport" ; private static final String GLOBAL_ACTION_KEY_SILENT = "silent" ; private static final String GLOBAL_ACTION_KEY_USERS = "users" ; private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings" ; private static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown" ; private final Context mContext ; private final WindowManagerFuncs mWindowManagerFuncs ; private final AudioManager mAudioManager ; private final IDreamManager mDreamManager ; private ArrayList < GlobalActions . Action > mItems ; private GlobalActions . GlobalActionsDialog mDialog ; private GlobalActions . Action mSilentModeAction ; private GlobalActions . ToggleAction mAirplaneModeOn ; private GlobalActions . MyAdapter mAdapter ; private boolean mKeyguardShowing = false ; private boolean mDeviceProvisioned = false ; private GlobalActions . ToggleAction . State mAirplaneState = GlobalActions . ToggleAction . State . Off ; private boolean mIsWaitingForEcmExit = false ; private boolean mHasTelephony ; private boolean mHasVibrator ; private final boolean mShowSilentToggle ; public GlobalActions ( Context context , WindowManagerFuncs windowManagerFuncs ) { } public void showDialog ( boolean keyguardShowing , boolean isDeviceProvisioned ) { } private void awakenIfNecessary ( ) { } private void handleShow ( ) { } private GlobalActions . GlobalActionsDialog createDialog ( ) { } private final class RebootAction extends GlobalActions . SinglePressAction implements GlobalActions . LongPressAction { private RebootAction ( ) { } @ Override public boolean onLongPress ( ) { } @ Override public boolean showDuringKeyguard ( ) { } @ Override public boolean showBeforeProvisioning ( ) { } @ Override public void onPress ( ) { } } private GlobalActions . Action ScreenrecordAction ( ) { } private GlobalActions . Action ScreenshotAction ( ) { } private GlobalActions . Action getBugReportAction ( ) { } private GlobalActions . Action getPowerAction ( ) { } private GlobalActions . Action getSettingsAction ( ) { } private GlobalActions . Action getLockdownAction ( ) { } private UserInfo getCurrentUser ( ) { } private boolean isCurrentUserOwner ( ) { } private void addUsersToMenu ( ArrayList < GlobalActions . Action > items ) { } final Object mScreenrecordLock = new Object ( ) ; ServiceConnection mScreenrecordConnection = null ; final Runnable mScreenrecordTimeout = new Runnable ( ) { @ Override public void run ( ) { } } ; private void takeScreenrecord ( ) { synchronized ( mScreenrecordLock ) { if ( ( mScreenrecordConnection ) != null ) { return ; } <START_BUG> ComponentName cn = new ComponentName ( "com.android.systemui" , "com.android.systemui.du.screenrecord.TakeScreenrecordService" ) ; <END_BUG> Intent intent = new Intent ( ) ; intent . setComponent ( cn ) ; ServiceConnection conn = new ServiceConnection ( ) { @ Override public void onServiceConnected ( ComponentName name , IBinder service ) { synchronized ( mScreenrecordLock ) { Messenger messenger = new Messenger ( service ) ; Message msg = Message . obtain ( null , 1 ) ; final ServiceConnection myConn = this ; Handler h = new Handler ( mHandler . getLooper ( ) ) { @ Override public void handleMessage ( Message msg ) { synchronized ( mScreenrecordLock ) { if ( ( mScreenrecordConnection ) == myConn ) { mContext . unbindService ( mScreenrecordConnection ) ; mScreenrecordConnection = null ; mHandler . removeCallbacks ( mScreenrecordTimeout ) ; } } } } ; msg . replyTo = new Messenger ( h ) ; msg . arg1 = msg . arg2 = 0 ; try { messenger . send ( msg ) ; } catch ( RemoteException e ) { } } } @ Override public void onServiceDisconnected ( ComponentName name ) { } } ; if ( mContext . bindServiceAsUser ( intent , conn , BIND_AUTO_CREATE , CURRENT ) ) { mScreenrecordConnection = conn ; mHandler . postDelayed ( mScreenrecordTimeout , ( ( 31 * 60 ) * 1000 ) ) ; } } } final Object mScreenshotLock = new Object ( ) ; ServiceConnection mScreenshotConnection = null ; final Runnable mScreenshotTimeout = new Runnable ( ) { @ Override public void run ( ) { } } ; private void takeScreenshot ( ) { } private void prepareDialog ( ) { } private void refreshSilentMode ( ) { } public void onDismiss ( DialogInterface dialog ) { } public void onClick ( DialogInterface dialog , int which ) { } private class MyAdapter extends BaseAdapter { public int getCount ( ) { } @ Override public boolean isEnabled ( int position ) { } @ Override public boolean areAllItemsEnabled ( ) { } public GlobalActions . Action getItem ( int position ) { } public long getItemId ( int position ) { } public View getView ( int position , View convertView , ViewGroup parent ) { } } private interface Action { CharSequence getLabelForAccessibility ( Context context ) { } View create ( Context context , View convertView , ViewGroup parent , LayoutInflater inflater ) { } void onPress ( ) { } boolean showDuringKeyguard ( ) { } boolean showBeforeProvisioning ( ) { } boolean isEnabled ( ) { } } private interface LongPressAction extends GlobalActions . Action { boolean onLongPress ( ) { } } private static abstract class SinglePressAction implements GlobalActions . Action { private final int mIconResId ; private final Drawable mIcon ; private final int mMessageResId ; private final CharSequence mMessage ; protected SinglePressAction ( int iconResId , int messageResId ) { } protected SinglePressAction ( int iconResId , Drawable icon , CharSequence message ) { } protected SinglePressAction ( int iconResId , CharSequence message ) { } public boolean isEnabled ( ) { } public String getStatus ( ) { } public abstract void onPress ( ) { } public CharSequence getLabelForAccessibility ( Context context ) { }

Fix:
ComponentName cn = new ComponentName ( "com.android.systemui" , "com.android.systemui.venture.screenrecord.TakeScreenrecordService" ) ;