show quarantine count (non-release only)

Looks like I'm occasionally leaking so that the count grows. This will
let me see when something is 1 when it should be 0.
This commit is contained in:
Eric House 2020-10-26 10:29:03 -07:00
parent 9deac8afbb
commit 712661a6e9
3 changed files with 22 additions and 6 deletions

View file

@ -353,6 +353,11 @@ public class GameListItem extends LinearLayout
// Setting to 0 clears, which we want
ImageView iv = (ImageView)findViewById( R.id.has_chat_marker );
iv.setImageResource( resID );
if ( BuildConfig.NON_RELEASE ) {
int quarCount = Quarantine.getCount( m_rowid );
((TextView)findViewById(R.id.corrupt_count_marker))
.setText( 0 == quarCount ? "" : "" + quarCount );
}
if ( XWPrefs.moveCountEnabled( m_context ) ) {
TextView tv = (TextView)findViewById( R.id.n_pending );

View file

@ -31,13 +31,20 @@ public class Quarantine {
private static final String TAG = Quarantine.class.getSimpleName();
private static final String DATA_KEY = TAG + "/key";
private static final int BAD_COUNT = 2;
private static Data[] sDataRef = {null};
public static int getCount( long rowid )
{
int result;
synchronized ( sDataRef ) {
result = get().getFor( rowid );
}
return result;
}
public static boolean safeToOpen( long rowid )
{
int count;
synchronized ( sDataRef ) {
count = get().getFor( rowid );
}
int count = getCount( rowid );
boolean result = count < BAD_COUNT;
if ( !result ) {
Log.d( TAG, "safeToOpen(%d) => %b (count=%d)", rowid, result, count );
@ -136,8 +143,6 @@ public class Quarantine {
}
}
private static Data[] sDataRef = {null};
private static void store()
{
synchronized( sDataRef ) {

View file

@ -53,6 +53,12 @@
android:layout_height="22dp"
android:layout_alignParentBottom="true"
/>
<!-- Debug only -->
<TextView android:id="@+id/corrupt_count_marker"
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_alignParentBottom="true"
/>
<TextView android:id="@+id/dup_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"