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
206 changed files
with
5,377 additions
and
37,577 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
# built application files | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
uiautomator/output/ | ||
|
||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# files for the dex VM | ||
# Files for the Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# generated files | ||
# Generated files | ||
bin/ | ||
gen/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Eclipse project files | ||
.classpath | ||
.project | ||
/build.xml | ||
/proguard | ||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
.idea/ | ||
out/ | ||
/app/manifest-merger-release-report.txt | ||
*.iml |
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,48 @@ | ||
import java.text.SimpleDateFormat | ||
|
||
apply plugin: 'com.android.application' | ||
|
||
// バージョン名 | ||
// versionCodeに使用するため、「{0-99}.{0-99}.{0-99}」で指定すること。 | ||
def verName = "2.0.0" | ||
|
||
android { | ||
compileSdkVersion 21 | ||
buildToolsVersion "21.1.2" | ||
|
||
defaultConfig { | ||
applicationId "com.nagopy.android.disablemanager2" | ||
minSdkVersion 15 | ||
targetSdkVersion 21 | ||
versionName verName | ||
versionCode Integer.parseInt(verName.split("\\.")[0]) * 10000 + Integer.parseInt(verName.split("\\.")[1]) * 100 + Integer.parseInt(verName.split("\\.")[2]) | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_7 | ||
targetCompatibility JavaVersion.VERSION_1_7 | ||
} | ||
|
||
packagingOptions { | ||
exclude 'LICENSE.txt' | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:appcompat-v7:21.0.3' | ||
compile 'com.android.support:support-annotations:21.0.3' | ||
compile 'com.viewpagerindicator:library:2.4.1@aar' | ||
|
||
androidTestCompile 'com.android.support:support-annotations:21.0.3' | ||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0' | ||
androidTestCompile 'com.android.support.test:testing-support-lib:0.1' | ||
androidTestCompile 'org.mockito:mockito-core:1.9.5' | ||
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2" | ||
} |
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,11 @@ | ||
-assumenosideeffects public class android.util.Log { | ||
public static *** v(...); | ||
public static *** d(...); | ||
public static *** i(...); | ||
public static *** w(...); | ||
public static *** e(...); | ||
public static *** wtf(...); | ||
} | ||
-assumenosideeffects class com.nagopy.android.disablemanager2.support.DebugUtil { | ||
<methods>; | ||
} |
120 changes: 120 additions & 0 deletions
120
app/src/androidTest/java/com/nagopy/android/disablemanager2/FilterTypeTest.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,120 @@ | ||
package com.nagopy.android.disablemanager2; | ||
|
||
|
||
import org.junit.Test; | ||
import org.mockito.Mockito; | ||
|
||
import static junit.framework.Assert.assertEquals; | ||
import static junit.framework.Assert.assertFalse; | ||
import static junit.framework.Assert.assertTrue; | ||
|
||
public class FilterTypeTest { | ||
|
||
@Test | ||
public void test_indexOf() throws Exception { | ||
assertEquals(FilterType.DISABLABLE, FilterType.indexOf(0)); | ||
assertEquals(FilterType.DISABLED, FilterType.indexOf(1)); | ||
assertEquals(FilterType.UNDISABLABLE, FilterType.indexOf(2)); | ||
assertEquals(FilterType.USER, FilterType.indexOf(3)); | ||
} | ||
|
||
@Test | ||
public void test_filter() throws Exception { | ||
{ | ||
// 無効になっているユーザーアプリ(rootedならありうる) | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = false; | ||
appData.isSystem = false; | ||
appData.canDisable = false; | ||
|
||
assertFalse(FilterType.DISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.DISABLED.isTarget(appData)); | ||
assertFalse(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertTrue(FilterType.USER.isTarget(appData)); | ||
} | ||
{ | ||
// ユーザーアプリ | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = true; | ||
appData.isSystem = false; | ||
appData.canDisable = false; | ||
|
||
assertFalse(FilterType.DISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.DISABLED.isTarget(appData)); | ||
assertFalse(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertTrue(FilterType.USER.isTarget(appData)); | ||
} | ||
{ | ||
// 無効にできないはずだけど無効になっているシステムアプリ(rootedなど?) | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = false; | ||
appData.isSystem = true; | ||
appData.canDisable = false; | ||
|
||
assertFalse(FilterType.DISABLABLE.isTarget(appData)); | ||
assertTrue(FilterType.DISABLED.isTarget(appData)); | ||
assertFalse(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.USER.isTarget(appData)); | ||
} | ||
{ | ||
// 無効にできるけどシステムアプリではない(通常ありえない) | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = false; | ||
appData.isSystem = false; | ||
appData.canDisable = true; | ||
|
||
assertFalse(FilterType.DISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.DISABLED.isTarget(appData)); | ||
assertFalse(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertTrue(FilterType.USER.isTarget(appData)); | ||
} | ||
{ | ||
//無効化できないシステムアプリ | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = true; | ||
appData.isSystem = true; | ||
appData.canDisable = false; | ||
|
||
assertFalse(FilterType.DISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.DISABLED.isTarget(appData)); | ||
assertTrue(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.USER.isTarget(appData)); | ||
} | ||
{ | ||
// 無効化できる非システムアプリ(通常ありえない) | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = true; | ||
appData.isSystem = false; | ||
appData.canDisable = true; | ||
|
||
assertFalse(FilterType.DISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.DISABLED.isTarget(appData)); | ||
assertFalse(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertTrue(FilterType.USER.isTarget(appData)); | ||
} | ||
{ | ||
// 無効化されたアプリ | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = false; | ||
appData.isSystem = true; | ||
appData.canDisable = true; | ||
|
||
assertFalse(FilterType.DISABLABLE.isTarget(appData)); | ||
assertTrue(FilterType.DISABLED.isTarget(appData)); | ||
assertFalse(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.USER.isTarget(appData)); | ||
} | ||
{ | ||
// 無効化可能アプリ | ||
AppData appData = Mockito.mock(AppData.class); | ||
appData.isEnabled = true; | ||
appData.isSystem = true; | ||
appData.canDisable = true; | ||
|
||
assertTrue(FilterType.DISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.DISABLED.isTarget(appData)); | ||
assertFalse(FilterType.UNDISABLABLE.isTarget(appData)); | ||
assertFalse(FilterType.USER.isTarget(appData)); | ||
} | ||
} | ||
} |
Oops, something went wrong.