Skip to content

Commit

Permalink
Add intentional stop intent call for PD
Browse files Browse the repository at this point in the history
  • Loading branch information
Grennith committed Dec 18, 2023
1 parent fb0d11d commit d0da21d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mapadroid/ocr/screenPath.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ async def __handle_google_login(self, screentype) -> ScreenType:
if await self.parse_ggl(await self._communicator.uiautomator(), usernames_to_check_for):
logger.info("Sleeping 50 seconds after clicking the account to login with - please wait!")
await asyncio.sleep(50)
await self._communicator.passthrough(
"su -c 'am broadcast -a com.mad.pogodroid.SET_INTENTIONAL_STOP -c android.intent.category.DEFAULT -n com.mad.pogodroid/.IntentionalStopSetterReceiver --ez value false'")
await asyncio.sleep(5)
await self._communicator.passthrough(
"su -c 'am startservice -n com.mad.pogodroid/.services.HookReceiverService'")
else:
Expand Down Expand Up @@ -507,6 +510,9 @@ async def __handle_ptc_login(self) -> ScreenType:
logger.info("Clicking Log In and sleeping 50 seconds - please wait!")
await asyncio.sleep(50)
# Start pogodroid service again to make sure we are running PD properly here
await self._communicator.passthrough(
"su -c 'am broadcast -a com.mad.pogodroid.SET_INTENTIONAL_STOP -c android.intent.category.DEFAULT -n com.mad.pogodroid/.IntentionalStopSetterReceiver --ez value false'")
await asyncio.sleep(5)
await self._communicator.passthrough(
"su -c 'am startservice -n com.mad.pogodroid/.services.HookReceiverService'")
return ScreenType.PTC
Expand Down Expand Up @@ -562,6 +568,9 @@ async def __handle_returning_player_or_wrong_credentials(self) -> None:

async def __handle_birthday_screen(self) -> None:
# First disable pogodroid at this point to avoid the injection triggering any checks in other libraries
await self._communicator.passthrough(
"su -c 'am broadcast -a com.mad.pogodroid.SET_INTENTIONAL_STOP -c android.intent.category.DEFAULT -n com.mad.pogodroid/.IntentionalStopSetterReceiver --ez value true'")
await asyncio.sleep(5)
await self._communicator.passthrough(
"su -c 'am stopservice -n com.mad.pogodroid/.services.HookReceiverService'")
await self._communicator.restart_app("com.nianticlabs.pokemongo")
Expand Down
3 changes: 3 additions & 0 deletions mapadroid/worker/strategy/AbstractMitmBaseStrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ async def _additional_health_check(self) -> None:
# Ensure PogoDroid was started...
if not await self.get_devicesettings_value(MappingManagerDevicemappingKey.EXTENDED_PERMISSION_TOGGLING, False):
return
await self._communicator.passthrough(
"su -c 'am broadcast -a com.mad.pogodroid.SET_INTENTIONAL_STOP -c android.intent.category.DEFAULT -n com.mad.pogodroid/.IntentionalStopSetterReceiver --ez value false'")
await asyncio.sleep(5)
await self._communicator.passthrough(
"su -c 'am startservice -n com.mad.pogodroid/.services.HookReceiverService'")

Expand Down

0 comments on commit d0da21d

Please sign in to comment.