MainActivity.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. package de.tudarmstadt.informatik.hostage.ui;
  2. import java.io.BufferedReader;
  3. import java.io.InputStreamReader;
  4. import java.util.ArrayList;
  5. import java.util.HashMap;
  6. import android.app.Activity;
  7. import android.app.ActivityManager;
  8. import android.app.ActivityManager.RunningServiceInfo;
  9. import android.content.BroadcastReceiver;
  10. import android.content.ComponentName;
  11. import android.content.Context;
  12. import android.content.Intent;
  13. import android.content.IntentFilter;
  14. import android.content.ServiceConnection;
  15. import android.content.SharedPreferences;
  16. import android.os.Bundle;
  17. import android.os.Handler;
  18. import android.os.IBinder;
  19. import android.support.v4.content.LocalBroadcastManager;
  20. import android.util.Log;
  21. import android.view.GestureDetector;
  22. import android.view.GestureDetector.SimpleOnGestureListener;
  23. import android.view.Menu;
  24. import android.view.MenuItem;
  25. import android.view.MotionEvent;
  26. import android.view.View;
  27. import android.view.View.OnTouchListener;
  28. import android.view.animation.Animation;
  29. import android.view.animation.AnimationUtils;
  30. import android.widget.AdapterView;
  31. import android.widget.AdapterView.OnItemClickListener;
  32. import android.widget.CheckBox;
  33. import android.widget.ImageView;
  34. import android.widget.ListView;
  35. import android.widget.TextView;
  36. import android.widget.ToggleButton;
  37. import android.widget.ViewAnimator;
  38. import de.tudarmstadt.informatik.hostage.HoneyService;
  39. import de.tudarmstadt.informatik.hostage.HoneyService.LocalBinder;
  40. import de.tudarmstadt.informatik.hostage.R;
  41. import de.tudarmstadt.informatik.hostage.commons.HelperUtils;
  42. import de.tudarmstadt.informatik.hostage.logging.LogResultReceiver;
  43. import de.tudarmstadt.informatik.hostage.logging.LogResultReceiver.Receiver;
  44. import de.tudarmstadt.informatik.hostage.logging.Logger;
  45. import de.tudarmstadt.informatik.hostage.logging.UglyDbHelper;
  46. /**
  47. * MainActivity is the central activity for the GUI of the application.
  48. * MainActivity is launched when the application is first started. It shows the
  49. * user: <br>
  50. * - information about the network<br>
  51. * - light indicators for recorded attacks on each protocol<br>
  52. * - amount of attacks on each protocols<br>
  53. * The user can start and stop services.
  54. *
  55. * @author Mihai Plasoianu
  56. * @author Lars Pandikow
  57. * @author Wulf Pfeiffer
  58. */
  59. public class MainActivity extends Activity implements Receiver {
  60. /**
  61. * Flag for root acces. True if phone has root acces, else false.
  62. */
  63. public static boolean isRooted = false;
  64. /**
  65. * Flag for porthack. True if porthack is installed, else false.
  66. */
  67. public static boolean porthackInstalled = false;
  68. /**
  69. * Integer representing a grey light.
  70. */
  71. public static final int LIGHT_GREY = 0x01;
  72. /**
  73. * Integer representing a green light.
  74. */
  75. public static final int LIGHT_GREEN = 0x02;
  76. /**
  77. * Integer representing a red light.
  78. */
  79. public static final int LIGHT_RED = 0x03;
  80. /**
  81. * Integer representing a yellow light.
  82. */
  83. public static final int LIGHT_YELLOW = 0x04;
  84. public LogResultReceiver logResultReceiver;
  85. private SharedPreferences connectionInfo;
  86. private HoneyService mService;
  87. private boolean serviceBound;
  88. // variables for the swipe animation
  89. private ViewAnimator viewAnimator;
  90. private GestureDetector gestureDetector;
  91. private Animation animFlipInLR;
  92. private Animation animFlipOutLR;
  93. private Animation animFlipInRL;
  94. private Animation animFlipOutRL;
  95. private ListView listView;
  96. private ListViewAdapter adapter;
  97. private boolean isBssidSeen = false;
  98. /**
  99. * Connection to bind the background service
  100. *
  101. * @see HoneyService
  102. */
  103. private ServiceConnection mConnection = new ServiceConnection() {
  104. /**
  105. * After the service is bound, check which has been clicked and start
  106. * it.
  107. *
  108. * @see android.content.ServiceConnection#onServiceConnected(android.content.ComponentName)
  109. */
  110. @Override
  111. public void onServiceConnected(ComponentName name, IBinder service) {
  112. mService = ((LocalBinder) service).getService();
  113. serviceBound = true;
  114. updateUI();
  115. }
  116. /**
  117. * After the service is unbound, delete reference.
  118. *
  119. * @see android.content.ServiceConnection#onServiceDisconnected(android.content.ComponentName)
  120. */
  121. @Override
  122. public void onServiceDisconnected(ComponentName name) {
  123. mService = null;
  124. serviceBound = false;
  125. }
  126. };
  127. /**
  128. * Receiver for custom broadcast.
  129. *
  130. * @see #BROADCAST
  131. */
  132. private BroadcastReceiver mReceiver = new BroadcastReceiver() {
  133. @Override
  134. public void onReceive(Context context, Intent intent) {
  135. // Update user interface.
  136. updateUI();
  137. updateConnectionInfText();
  138. }
  139. };
  140. SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener() {
  141. @Override
  142. public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
  143. float velocityY) {
  144. float sensitvity = 50;
  145. if ((e1.getX() - e2.getX()) > sensitvity) {
  146. swipeRightToLeft();
  147. } else if ((e2.getX() - e1.getX()) > sensitvity) {
  148. swipeLeftToRight();
  149. }
  150. return true;
  151. }
  152. };
  153. /**
  154. * Called when User presses on/off button.
  155. *
  156. * @param view
  157. */
  158. public void buttonOnOffClick(View view) {
  159. if (((ToggleButton) view).isChecked()) {
  160. if (isParanoid()) {
  161. String[] protocols = getResources().getStringArray(
  162. R.array.protocols);
  163. for (String protocol : protocols) {
  164. mService.startListener(protocol);
  165. }
  166. } else {
  167. if (mService.isRunning("SMB")) {
  168. mService.stopListener("SMB");
  169. } else {
  170. mService.startListener("SMB");
  171. }
  172. }
  173. } else {
  174. mService.stopListeners();
  175. stopAndUnbind();
  176. }
  177. }
  178. @Override
  179. public boolean onCreateOptionsMenu(Menu menu) {
  180. getMenuInflater().inflate(R.menu.main, menu);
  181. return true;
  182. }
  183. @Override
  184. public boolean onOptionsItemSelected(MenuItem item) {
  185. // Handle item selection
  186. switch (item.getItemId()) {
  187. case R.id.action_settings:
  188. startActivity(new Intent(this, SettingsActivity.class));
  189. break;
  190. case R.id.action_about:
  191. startActivity(new Intent(this, AboutActivity.class));
  192. break;
  193. default:
  194. }
  195. return super.onOptionsItemSelected(item);
  196. }
  197. @Override
  198. public void onReceiveResult(int resultCode, Bundle resultData) {
  199. isBssidSeen = resultData.getBoolean("result");
  200. }
  201. @Override
  202. public boolean onTouchEvent(MotionEvent event) {
  203. return gestureDetector.onTouchEvent(event);
  204. }
  205. /**
  206. * Starts the ViewLog activity, when the Button is pressed.
  207. *
  208. * @see ViewLog
  209. * @param view
  210. * View elements which triggers the method call.
  211. */
  212. public void showLog(View view) {
  213. startActivity(new Intent(this, ViewLog.class));
  214. }
  215. public void startPlayGround(View view) {
  216. startActivity(new Intent(this, PlayGroundActivity.class));
  217. }
  218. /**
  219. * Binds service to Activity
  220. *
  221. * @see HoneyService
  222. */
  223. private void bindService() {
  224. bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
  225. }
  226. /**
  227. * Checks if the phone ist rooted and if porthack is installed. Sets flags
  228. * {@link isRooted} and {@link porthackInstalled}
  229. */
  230. private void checkRootAndPorthack() {
  231. isRooted = false;
  232. porthackInstalled = false;
  233. Process p;
  234. try {
  235. String found = "Found";
  236. String notFound = "Not found";
  237. String command = "[ -f /data/local/p ] && echo " + found
  238. + " || echo " + notFound;
  239. p = Runtime.getRuntime().exec(new String[] { "su", "-c", command });
  240. BufferedReader in = new BufferedReader(new InputStreamReader(
  241. p.getInputStream()));
  242. /*
  243. * int av = byte[] b = new byte[av]; if (av != 0) { in.read(b); }
  244. */
  245. String echoResponse = in.readLine();
  246. Log.i("MainAc", echoResponse);
  247. if (echoResponse.equals(found)) {
  248. isRooted = true;
  249. porthackInstalled = true;
  250. } else if (echoResponse.equals(notFound)) {
  251. isRooted = true;
  252. }
  253. } catch (Exception e) {
  254. e.printStackTrace();
  255. }
  256. Log.i("MainAc", "Rooted: " + isRooted + " Porthack: "
  257. + porthackInstalled);
  258. }
  259. /**
  260. * Returns an intent to start HoneyService.
  261. *
  262. * @return An Intent to start HoneyService
  263. */
  264. private Intent getServiceIntent() {
  265. return new Intent(this, HoneyService.class);
  266. }
  267. /**
  268. * Initializes the ListView. Creating its contents dynamic from protocol
  269. * res/values/protocols.xml
  270. */
  271. private void initListView() {
  272. ArrayList<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
  273. for (String protocol : getResources().getStringArray(R.array.protocols)) {
  274. HashMap<String, String> d = new HashMap<String, String>();
  275. d.put("light", String.valueOf(R.drawable.light_grey));
  276. d.put("protocol", protocol);
  277. d.put("connections", "-");
  278. data.add(d);
  279. }
  280. listView = (ListView) findViewById(R.id.listViewProtocols);
  281. adapter = new ListViewAdapter(getLayoutInflater(), data);
  282. listView.setAdapter(adapter);
  283. listView.setOnTouchListener(new OnTouchListener() {
  284. @Override
  285. public boolean onTouch(View v, MotionEvent event) {
  286. return gestureDetector.onTouchEvent(event);
  287. }
  288. });
  289. listView.setOnItemClickListener(new OnItemClickListener() {
  290. @Override
  291. public void onItemClick(AdapterView<?> parent, View view,
  292. int position, long id) {
  293. String protocolName = (String) ((HashMap<?, ?>) adapter
  294. .getItem(position)).get("protocol");
  295. if (mService.isRunning(protocolName)) {
  296. mService.stopListener(protocolName);
  297. } else {
  298. mService.startListener(protocolName);
  299. }
  300. }
  301. });
  302. }
  303. /**
  304. * Initializes variables for screen animation
  305. */
  306. private void initViewAnimator() {
  307. viewAnimator = (ViewAnimator) findViewById(R.id.viewAnimator);
  308. gestureDetector = new GestureDetector(this, simpleOnGestureListener);
  309. animFlipInLR = AnimationUtils.loadAnimation(this,
  310. R.anim.in_left_to_right);
  311. animFlipOutLR = AnimationUtils.loadAnimation(this,
  312. R.anim.out_left_to_right);
  313. animFlipInRL = AnimationUtils.loadAnimation(this,
  314. R.anim.in_right_to_left);
  315. animFlipOutRL = AnimationUtils.loadAnimation(this,
  316. R.anim.out_right_to_left);
  317. }
  318. /**
  319. * Checks if user selected paranoid mode.
  320. *
  321. * @return True when paranoid mode is selected, else returns false.
  322. */
  323. private boolean isParanoid() {
  324. return ((CheckBox) findViewById(R.id.checkBoxParanoid)).isChecked();
  325. }
  326. /**
  327. * Checks if a {@link HoneyService} instance is running.
  328. *
  329. * @return True if {@link HoneyService} is running, else false.
  330. */
  331. private boolean isServiceBound() {
  332. return serviceBound;
  333. }
  334. /**
  335. * Checks if a {@link HoneyService} instance is running.
  336. *
  337. * @return True if {@link HoneyService} is running, else false.
  338. */
  339. private boolean isServiceRunning() {
  340. ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
  341. for (RunningServiceInfo service : manager
  342. .getRunningServices(Integer.MAX_VALUE)) {
  343. if (service.service.getClassName().equals(
  344. HoneyService.class.getName())) {
  345. return true;
  346. }
  347. }
  348. return false;
  349. }
  350. /**
  351. * Register broadcast receiver for custom broadcast.
  352. *
  353. * @see #BROADCAST
  354. */
  355. private void registerReceiver() {
  356. LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver,
  357. new IntentFilter(getString(R.string.broadcast)));
  358. }
  359. /**
  360. * If mobile phone is connected to a wireless network starts the background
  361. * service ands binds itself to it. Else notifies the user that service
  362. * could not be started.
  363. */
  364. private void startAndBind() {
  365. startService(getServiceIntent());
  366. bindService();
  367. }
  368. /**
  369. * Stops service and unbinds it.
  370. *
  371. * @see HoneyService
  372. */
  373. private void stopAndUnbind() {
  374. unbindService();
  375. stopService(getServiceIntent());
  376. }
  377. /**
  378. * Called when a swipe to the Right is registered.
  379. */
  380. private void swipeLeftToRight() {
  381. if (viewAnimator.getDisplayedChild() == 1) {
  382. viewAnimator.setInAnimation(animFlipInLR);
  383. viewAnimator.setOutAnimation(animFlipOutLR);
  384. viewAnimator.setDisplayedChild(0);
  385. }
  386. }
  387. /**
  388. * Called when a swipe to the Left is registered.
  389. */
  390. private void swipeRightToLeft() {
  391. if (viewAnimator.getDisplayedChild() == 0) {
  392. viewAnimator.setInAnimation(animFlipInRL);
  393. viewAnimator.setOutAnimation(animFlipOutRL);
  394. viewAnimator.setDisplayedChild(1);
  395. }
  396. }
  397. /**
  398. * Unbinds service.
  399. *
  400. * @see HoneyService
  401. */
  402. private void unbindService() {
  403. unbindService(mConnection);
  404. }
  405. /**
  406. * Unregisters broadcast receiver for custom broadcast.
  407. *
  408. * @see #BROADCAST
  409. */
  410. private void unregisterReceiver() {
  411. LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
  412. }
  413. /**
  414. * Gets Information about connection state and updates the GUI.
  415. */
  416. private void updateConnectionInfText() {
  417. TextView ssidView = (TextView) findViewById(R.id.textViewSSIDValue);
  418. TextView bssidView = (TextView) findViewById(R.id.textViewBSSIDValue);
  419. TextView internalIPView = (TextView) findViewById(R.id.textViewInternalIPValue);
  420. TextView externalIPView = (TextView) findViewById(R.id.textViewExternalIPValue);
  421. // externalIPView.setText("Loading...");
  422. // Get connection information
  423. String ssid = connectionInfo.getString(
  424. getString(R.string.connection_info_ssid), null);
  425. String bssid = connectionInfo.getString(
  426. getString(R.string.connection_info_bssid), null);
  427. String internalIP = connectionInfo.getString(
  428. getString(R.string.connection_info_internal_ip), null);
  429. String externalIP = connectionInfo.getString(
  430. getString(R.string.connection_info_external_ip), null);
  431. // Set text fields
  432. if (ssid != null)
  433. ssidView.setText(ssid);
  434. else
  435. ssidView.setText("-");
  436. if (bssid != null)
  437. bssidView.setText(bssid);
  438. else
  439. bssidView.setText("-");
  440. if (internalIP != null)
  441. internalIPView.setText(internalIP);
  442. else
  443. internalIPView.setText("-");
  444. if (externalIP != null)
  445. externalIPView.setText(externalIP);
  446. else
  447. externalIPView.setText("-");
  448. }
  449. /**
  450. * Sets the connections count for a given protocol.
  451. *
  452. * @param connections
  453. * New value for recorded connections.
  454. * @param protocolName
  455. * Name of the protocol which should be updated.
  456. */
  457. private void updateProtocolConnections(int connections, String protocolName) {
  458. for (int i = 0; i < adapter.getCount(); ++i) {
  459. HashMap<String, String> d = ((HashMap<String, String>) adapter
  460. .getItem(i));
  461. if (d.get("protocol").equals(protocolName)) {
  462. d.put("connections", String.valueOf(connections));
  463. }
  464. }
  465. adapter.notifyDataSetChanged();
  466. }
  467. /**
  468. * Sets the light indicator for a given protocol.
  469. *
  470. * @param light
  471. * Integer code to set the light color.
  472. * @param protocolName
  473. * Name of the protocol which should be updated.
  474. */
  475. private void updateProtocolLight(int light, String protocolName) {
  476. for (int i = 0; i < adapter.getCount(); ++i) {
  477. HashMap<String, String> d = (HashMap<String, String>) adapter
  478. .getItem(i);
  479. if (d.get("protocol").equals(protocolName)) {
  480. switch (light) {
  481. case LIGHT_GREY:
  482. d.put("light", String.valueOf(R.drawable.light_grey));
  483. d.put("connections", "-");
  484. break;
  485. case LIGHT_GREEN:
  486. d.put("light", String.valueOf(R.drawable.light_green));
  487. break;
  488. case LIGHT_RED:
  489. d.put("light", String.valueOf(R.drawable.light_red));
  490. break;
  491. case LIGHT_YELLOW:
  492. d.put("light", String.valueOf(R.drawable.light_yellow));
  493. break;
  494. }
  495. }
  496. }
  497. adapter.notifyDataSetChanged();
  498. }
  499. /**
  500. * Sets the big light indicator.
  501. *
  502. * @param light
  503. * Integer code to set the light color.
  504. * @see #LIGHT_GREY
  505. * @see #LIGHT_GREEN
  506. * @see #LIGHT_RED
  507. * @see #LIGHT_YELLOW
  508. */
  509. private void updateStatusLight(int light) {
  510. switch (light) {
  511. case LIGHT_GREY:
  512. ((ImageView) findViewById(R.id.imageViewLight))
  513. .setImageResource(R.drawable.light_grey_large);
  514. break;
  515. case LIGHT_GREEN:
  516. ((ImageView) findViewById(R.id.imageViewLight))
  517. .setImageResource(R.drawable.light_green_large);
  518. break;
  519. case LIGHT_RED:
  520. ((ImageView) findViewById(R.id.imageViewLight))
  521. .setImageResource(R.drawable.light_red_large);
  522. break;
  523. case LIGHT_YELLOW:
  524. ((ImageView) findViewById(R.id.imageViewLight))
  525. .setImageResource(R.drawable.light_yellow_large);
  526. break;
  527. }
  528. }
  529. /* ############# Help functions for animation ################## */
  530. /**
  531. * Updates Information shown by the GUI.
  532. */
  533. private void updateUI() {
  534. boolean activeListeners = false;
  535. boolean activeHandlers = false;
  536. boolean yellowLight = false;
  537. // Check for all protocols if listeners are active and attacks have been
  538. // recorded
  539. // Update protocol lights and connection information.
  540. for (String protocol : getResources().getStringArray(R.array.protocols)) {
  541. if (isServiceBound()) {
  542. // Check if protocol is active
  543. if (mService.isRunning(protocol)) {
  544. activeListeners = true;
  545. int handlerCount = mService
  546. .getNumberOfActiveConnections(protocol);
  547. // Check if attacks have been recorded in this session.
  548. if (handlerCount > 0) {
  549. activeHandlers = true;
  550. updateProtocolLight(LIGHT_RED, protocol);
  551. updateProtocolConnections(handlerCount, protocol);
  552. } else {
  553. // Check if the bssid of the wireless network has
  554. // already
  555. // been recorded as infected.
  556. Logger.isBssidSeen(getApplicationContext(), protocol,
  557. HelperUtils.getBSSID(getApplicationContext()),
  558. logResultReceiver);
  559. UglyDbHelper dbh = new UglyDbHelper(this);
  560. if (dbh.bssidSeen(
  561. protocol,
  562. connectionInfo
  563. .getString(
  564. getString(R.string.connection_info_bssid),
  565. null))) {
  566. updateProtocolLight(LIGHT_YELLOW, protocol);
  567. yellowLight = true;
  568. } else {
  569. updateProtocolLight(LIGHT_GREEN, protocol);
  570. }
  571. updateProtocolConnections(0, protocol);
  572. }
  573. } else {
  574. updateProtocolLight(LIGHT_GREY, protocol);
  575. }
  576. } else {
  577. updateProtocolLight(LIGHT_GREY, protocol);
  578. }
  579. }
  580. // Update the big attack indicator.
  581. if (activeListeners) {
  582. if (activeHandlers) {
  583. updateStatusLight(LIGHT_RED);
  584. } else {
  585. if (yellowLight) {
  586. updateStatusLight(LIGHT_YELLOW);
  587. } else {
  588. updateStatusLight(LIGHT_GREEN);
  589. }
  590. }
  591. ((ToggleButton) findViewById(R.id.toggleButtonOnOff))
  592. .setChecked(true);
  593. findViewById(R.id.checkBoxParanoid).setEnabled(false);
  594. } else {
  595. updateStatusLight(LIGHT_GREY);
  596. ((ToggleButton) findViewById(R.id.toggleButtonOnOff))
  597. .setChecked(false);
  598. findViewById(R.id.checkBoxParanoid).setEnabled(true);
  599. }
  600. }
  601. @Override
  602. protected void onCreate(Bundle savedInstanceState) {
  603. super.onCreate(savedInstanceState);
  604. logResultReceiver = new LogResultReceiver(new Handler());
  605. setContentView(R.layout.activity_main);
  606. connectionInfo = getSharedPreferences(
  607. getString(R.string.connection_info), Context.MODE_PRIVATE);
  608. // Create dynamic view elements
  609. initViewAnimator();
  610. initListView();
  611. // Initialize Class variables
  612. checkRootAndPorthack();
  613. startAndBind();
  614. }
  615. @Override
  616. protected void onDestroy() {
  617. // Unbind running service
  618. if (!mService.hasRunningListeners()) {
  619. stopAndUnbind();
  620. }
  621. super.onDestroy();
  622. }
  623. @Override
  624. protected void onStart() {
  625. super.onStart();
  626. // Register Broadcast Receiver
  627. registerReceiver();
  628. logResultReceiver.setReceiver(this);
  629. // Bind service if running, else check for connection change and delete
  630. // sessionData
  631. if (isServiceRunning()) {
  632. bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
  633. }
  634. // Update UI
  635. updateConnectionInfText();
  636. }
  637. @Override
  638. protected void onStop() {
  639. // Unregister Broadcast Receiver
  640. unregisterReceiver();
  641. logResultReceiver.setReceiver(null);
  642. super.onStop();
  643. }
  644. }