Upgrade to Pro — share decks privately, control downloads, hide ads and more …

コードを変更せずに デバッグメニューで Androidアプリの動作を変更する

takahirom
December 08, 2017

コードを変更せずに デバッグメニューで Androidアプリの動作を変更する

takahirom

December 08, 2017
Tweet

More Decks by takahirom

Other Decks in Programming

Transcript

  1. if (isShowTutorialTiming()) { showTutorial() } fun isShowTutorialTiming(): Boolean { //

    ࣍ͷλΠϛϯά·Ͱදࣔ͠ͳ͍ if (System.currentTimeMillis() < pref.getNextTutorialtiming()) { return false; } // 3ճ͔͠දࣔ͠ͳ͍ if (3 <= pref.getTutorialCount()) { return false; } return true; } ثُ٦زٔ،ٕ׾䌢ח邌爙׃׋ְ 儗וֲ׃תַׅ JT4IPX5VUPSJBM5JNJOHדUSVF׾鵤׃׋ְ
  2. if (isShowTutorialTiming()) { showTutorial() } fun isShowTutorialTiming(): Boolean { //

    ࣍ͷλΠϛϯά·Ͱදࣔ͠ͳ͍ if (System.currentTimeMillis() < pref.getNextTutorialtiming()) { return false; } // 3ճ͔͠දࣔ͠ͳ͍ if (3 <= pref.getTutorialCount()) { return false; } return true; } ؝٦س׾湫ׅ
  3. if (isShowTutorialTiming()) { showTutorial() } fun isShowTutorialTiming(): Boolean { if

    (pref.isAlwaysShowTutorialTiming()) { return true; } // ࣍ͷλΠϛϯά·Ͱදࣔ͠ͳ͍ if (System.currentTimeMillis() < pref.getNextTutorialtiming()) { return false; } // 3ճ͔͠දࣔ͠ͳ͍ if (3 <= pref.getTutorialCount()) { return false; } return true; } ؝٦س׾湫ׅ ❌ٔٔ٦أתד ؝٦سָⰅ׏ג׃תֲ
  4. if (isShowTutorialTiming()) { showTutorial() } } fun isShowTutorialTiming(): Boolean {

    if (BuildConfig.DEBUG) { if (pref.isAlwaysShowTutorialTiming()) { return true; } } // ࣍ͷλΠϛϯά·Ͱදࣔ͠ͳ͍ if (System.currentTimeMillis() < pref.getNextTutorialtiming()) { return false; } // 3ճ͔͠දࣔ͠ͳ͍ if (3 <= pref.getTutorialCount()) { return false; } return true; } ؝٦س׾湫ׅ ❌醱꧟ז؝٦سָ فٗتؙءّٝח
  5. @Aspect public class AspectExample { @Before("execution(* on*(..))") public void before()

    { System.out.println("before !!"); } } "TQFDU+ ֿ׸׌ֽדPOד㨣ת׷ًاحسָㄎל׸׋儗ח ؚٗ׾⳿ֿׅהָ⳿勻׷
  6. @Around("execution(boolean com...MainActivity.isShowTutorialTiming(..))") public boolean isShowTutorialDebug(ProceedingJoinPoint jp) { return true; }

    "TQFDU+׾⢪׏ג׫׷ ⭕ֿ׸׌ֽדثُ٦زٔ،ٕ⳿ׇ׷ ⭕EFCVHؿٕؓتח縧ֽלرغحؚ儗ך׫黝䘔דֹ׷
  7. "TQFDU+׾⢪׏ג׫׷ @Around("execution(boolean com...MainActivity.isShowTutorialTiming(..))") public boolean isShowTutorialDebug(ProceedingJoinPoint jp) { return true;

    } !"SPVOEדJT4IPX5VUPSJBM5JNJOHך⵸䖓חⳢ椚׾㙵׭鴥׬ ֿֿדכ׋׌ًاحسך鵤׶⦼חUSVF׾鵤׃גְ׷
  8. @Around("execution(boolean com...MainActivity.isShowTutorialTiming(..))") public boolean isShowTutorialDebug(ProceedingJoinPoint jp) { return true; }

    "TQFDU+׾⢪׏ג׫׷ ❌ًاحسせך㢌刿ד堣腉׃זֻז׷ ❌رغحؚך׋ןחֿ׸׾剅ֻ
  9. @Around("execution(* *.*(..)) && @annotation(com...DebugReturn)”) public boolean isShowTutorialDebug(ProceedingJoinPoint jp) { return

    true; } @DebugReturn fun isShowTutorialTiming(): Boolean { ... } "TQFDU+׾⢪׏ג׫׷ 暴㹀ך،ظذ٦ءّٝאְגְ׷ًاحسד USVF׾鵤ׅ״ֲח
  10. @Around("execution(* *.*(..)) && @annotation(com...DebugReturn)”) public boolean isShowTutorialDebug(ProceedingJoinPoint jp) { return

    true; } @DebugReturn fun isShowTutorialTiming(): Boolean { ... } "TQFDU+׾⢪׏ג׫׷ ❌ֿ׸׌ה䌢חUSVFחז׏ג׃תֲ ❌رؿٕؓزך㹋鄲ָㄎן⳿ׇזְ
  11. @Around("execution(* *.*(..)) && @annotation(com...DebugReturn)”) public Object debugReturnMethod(ProceedingJoinPoint jp) { //

    ΞϊςʔγϣϯͷதͷҾ਺(key)Λऔಘ͢Δॲཧ ... final DebugSetting debugSetting = DebugSetting.getInstance(); if (debugSetting.contains(key)) { return debugSetting.get(key); } return jp.proceed(); } @DebugReturn(“tutorial”) fun isShowTutorialTiming(): Boolean { ... } "TQFDU+׾⢪׏ג׫׷
  12. @Around("execution(* *.*(..)) && @annotation(com...DebugReturn)”) public Object debugReturnMethod(ProceedingJoinPoint jp) { //

    ΞϊςʔγϣϯͷதͷҾ਺(key)Λऔಘ͢Δॲཧ ... final DebugSetting debugSetting = DebugSetting.getInstance(); if (debugSetting.contains(key)) { return debugSetting.get(key); } return jp.proceed(); } @DebugReturn(“tutorial”) fun isShowTutorialTiming(): Boolean { ... } "TQFDU+׾⢪׏ג׫׷ ،ظذ٦ءّٝחLFZ׾床ׅ
  13. @Around("execution(* *.*(..)) && @annotation(com...DebugReturn)”) public Object debugReturnMethod(ProceedingJoinPoint jp) { //

    ΞϊςʔγϣϯͷதͷҾ਺(key)Λऔಘ͢Δॲཧ ... final DebugSetting debugSetting = DebugSetting.getInstance(); if (debugSetting.contains(key)) { return debugSetting.get(key); } return jp.proceed(); } "TQFDU+׾⢪׏ג׫׷ ،ظذ٦ءָّٝאְ׋ًاحسךⳢ椚 ׮ה׮הךثُ٦زٔ،ٕⴻ㹀ٗآحؙ ׾ 㹋遤 1SFGFSFODFח⥂䭯׃גְ׋鏣㹀׾⢪ֲ
  14. @Around("execution(* *.*(..)) && @annotation(com...DebugReturn)”) public Object debugReturnMethod(ProceedingJoinPoint jp) { //

    ΞϊςʔγϣϯͷதͷҾ਺(key)Λऔಘ͢Δॲཧ ... final DebugSetting debugSetting = DebugSetting.getInstance(); if (debugSetting.contains(key)) { return debugSetting.get(key); } return jp.proceed(); } "TQFDU+׾⢪׏ג׫׷ 鏣㹀׾⥂㶷׃גְֶגծ鏣㹀ָ֮׸ל׉׸׾⢪ְ זֽ׸לծًاحسⰻך傀㶷ךⳢ椚׾遤ֲ