forked from aaronjwood/PortAuthority
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
107 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/aaronjwood/portauthority/PortAuthority.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.aaronjwood.portauthority; | ||
|
||
import android.app.Application; | ||
import android.os.Process; | ||
|
||
import com.squareup.leakcanary.LeakCanary; | ||
|
||
public class PortAuthority extends Application { | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
if (LeakCanary.isInAnalyzerProcess(this)) { | ||
// This process is dedicated to LeakCanary for heap analysis. | ||
// You should not init your app in this process. | ||
return; | ||
} | ||
|
||
LeakCanary.install(this); | ||
checkReplacingState(); // Workaround for https://issuetracker.google.com/issues/36972466 | ||
} | ||
|
||
/** | ||
* Kills the process if we can't get our own resources. | ||
*/ | ||
private void checkReplacingState() { | ||
if (getResources() == null) { | ||
Process.killProcess(Process.myPid()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.