nus-yam/ex-repair huggingface dataset:
Program: 197458
Project: 197458
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197460
Project: 197460
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197465
Project: 197465
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197467
Project: 197467
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197468
Project: 197468
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197469
Project: 197469
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197470
Project: 197470
Buggy source:
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    String key=readString();
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}
Program: 197471
Project: 197471
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    String key=readString();
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
  outVal.validate();
}
Program: 197472
Project: 197472
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeString(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 197473
Project: 197473
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197474
Project: 197474
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197475
Project: 197475
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197476
Project: 197476
Buggy source:
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    String key=readString();
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}
Program: 197477
Project: 197477
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    String key=readString();
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
  outVal.validate();
}
Program: 197478
Project: 197478
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeString(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 197479
Project: 197479
Buggy source:
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    String key=readString();
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}
Program: 197480
Project: 197480
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    String key=readString();
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
  outVal.validate();
}
Program: 197481
Project: 197481
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeString(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 197482
Project: 197482
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197483
Project: 197483
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197484
Project: 197484
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197485
Project: 197485
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197486
Project: 197486
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197487
Project: 197487
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197488
Project: 197488
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    positionClockAndNotifications();
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  positionClockAndNotifications();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}
Program: 197489
Project: 197489
Buggy source:
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    String key=readString();
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}
Program: 197490
Project: 197490
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    String key=readString();
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
  outVal.validate();
}
Program: 197491
Project: 197491
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeString(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 197493
Project: 197493
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197498
Project: 197498
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197500
Project: 197500
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197502
Project: 197502
Buggy source:
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newFrameLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newFrameLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}

Fixed version (ground truth):
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  setOrientation(LinearLayout.VERTICAL);
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newLinearLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newLinearLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}