Program: 181206
Project: 181206
Buggy source:
protected void onCreate(Bundle savedInstanceState){
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.grant_credentials_permission);
  mInflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final Bundle extras=getIntent().getExtras();
  mAccount=extras.getParcelable(EXTRAS_ACCOUNT);
  mAuthTokenType=extras.getString(EXTRAS_AUTH_TOKEN_TYPE);
  if (mAccount == null || mAuthTokenType == null) {
    setResult(Activity.RESULT_CANCELED);
    finish();
    return;
  }
  mUid=extras.getInt(EXTRAS_REQUESTING_UID);
  final String accountTypeLabel=extras.getString(EXTRAS_ACCOUNT_TYPE_LABEL);
  final String[] packages=extras.getStringArray(EXTRAS_PACKAGES);
  final String authTokenLabel=extras.getString(EXTRAS_AUTH_TOKEN_LABEL);
  findViewById(R.id.allow_button).setOnClickListener(this);
  findViewById(R.id.deny_button).setOnClickListener(this);
  LinearLayout packagesListView=(LinearLayout)findViewById(R.id.packages_list);
  final PackageManager pm=getPackageManager();
  for (  String pkg : packages) {
    String packageLabel;
    try {
      packageLabel=pm.getApplicationLabel(pm.getApplicationInfo(pkg,0)).toString();
    }
 catch (    PackageManager.NameNotFoundException e) {
      packageLabel=pkg;
    }
    packagesListView.addView(newPackageView(packageLabel));
  }
  ((TextView)findViewById(R.id.account_name)).setText(mAccount.name);
  ((TextView)findViewById(R.id.account_type)).setText(accountTypeLabel);
  TextView authTokenTypeView=(TextView)findViewById(R.id.authtoken_type);
  if (TextUtils.isEmpty(authTokenLabel)) {
    authTokenTypeView.setVisibility(View.GONE);
  }
 else {
    authTokenTypeView.setText(authTokenLabel);
  }
}

Fixed version (ground truth):
protected void onCreate(Bundle savedInstanceState){
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.grant_credentials_permission);
  mInflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final Bundle extras=getIntent().getExtras();
  mAccount=extras.getParcelable(EXTRAS_ACCOUNT);
  mAuthTokenType=extras.getString(EXTRAS_AUTH_TOKEN_TYPE);
  mUid=extras.getInt(EXTRAS_REQUESTING_UID);
  final PackageManager pm=getPackageManager();
  final String[] packages=pm.getPackagesForUid(mUid);
  if (mAccount == null || mAuthTokenType == null || packages == null) {
    setResult(Activity.RESULT_CANCELED);
    finish();
    return;
  }
  final String accountTypeLabel=accountManagerService.getAccountLabel(mAccount.type);
  final TextView authTokenTypeView=(TextView)findViewById(R.id.authtoken_type);
  authTokenTypeView.setVisibility(View.GONE);
  IAccountManagerResponse response=new IAccountManagerResponse.Stub(){
    public void onResult(    Bundle bundle){
      final String authTokenLabel=bundle.getString(AccountManager.KEY_AUTH_TOKEN_LABEL);
      if (!TextUtils.isEmpty(authTokenLabel)) {
        runOnUiThread(new Runnable(){
          public void run(){
            if (!isFinishing()) {
              authTokenTypeView.setText(authTokenLabel);
              authTokenTypeView.setVisibility(View.VISIBLE);
            }
          }
        }
);
      }
    }
    public void onError(    int code,    String message){
    }
  }
;
  accountManagerService.getAuthTokenLabel(response,mAccount,mAuthTokenType);
  findViewById(R.id.allow_button).setOnClickListener(this);
  findViewById(R.id.deny_button).setOnClickListener(this);
  LinearLayout packagesListView=(LinearLayout)findViewById(R.id.packages_list);
  for (  String pkg : packages) {
    String packageLabel;
    try {
      packageLabel=pm.getApplicationLabel(pm.getApplicationInfo(pkg,0)).toString();
    }
 catch (    PackageManager.NameNotFoundException e) {
      packageLabel=pkg;
    }
    packagesListView.addView(newPackageView(packageLabel));
  }
  ((TextView)findViewById(R.id.account_name)).setText(mAccount.name);
  ((TextView)findViewById(R.id.account_type)).setText(accountTypeLabel);
}