Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
Close the cpu buffer to (fix a strict mode violation)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlern2k committed Sep 23, 2016
1 parent 7802a3e commit bd2fa85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.widget.TextView;
import com.facebook.device.yearclass.YearClass;

Expand All @@ -24,6 +25,18 @@ public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath()
.build());
}

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private static int getCoresFromFileInfo(String fileLocation) {
InputStream is = new FileInputStream(fileLocation);
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String fileContents = buf.readLine();
buf.close();
return getCoresFromFileString(fileContents);
} catch (IOException e) {
return DEVICEINFO_UNKNOWN;
Expand Down

0 comments on commit bd2fa85

Please sign in to comment.