{"action":"created","comment":{"url":"https://api.github.com/repos/syncthing/syncthing-android/pulls/comments/191085136","pull_request_review_id":123592378,"id":191085136,"diff_hunk":"@@ -208,6 +212,49 @@ private boolean useWakeLock() {\n         return mPreferences.getBoolean(Constants.PREF_USE_WAKE_LOCK, false);\n     }\n \n+    /**\n+     * Look for running libsyncthing.so processes and store the PID of each instance.\n+     */\n+    private void getSyncthingPIDs() {\n+        Process ps = null;\n+        DataOutputStream psOut = null;\n+        BufferedReader br = null;\n+        mLibSyncthingPID.clear();\n+        try {\n+            ps = Runtime.getRuntime().exec((mUseRoot) ? \"su\" : \"sh\");\n+            psOut = new DataOutputStream(ps.getOutputStream());\n+            psOut.writeBytes(\"ps\\n\");\n+            psOut.writeBytes(\"exit\\n\");\n+            psOut.flush();\n+            ps.waitFor();\n+            br = new BufferedReader(new InputStreamReader(ps.getInputStream(), \"UTF-8\"));\n+            String line;\n+            while ((line = br.readLine()) != null) {\n+                if (line.contains(Constants.FILENAME_SYNCTHING_BINARY)) {\n+                    String syncthingPID = line.trim().split(\"\\\\s+\")[1];\n+                    Log.v(TAG, \"getSyncthingPIDs: Found process PID [\" + syncthingPID + \"]\");\n+                    mLibSyncthingPID.add(syncthingPID);\n+                }\n+            }\n+        } catch (IOException | InterruptedException e) {\n+            Log.w(TAG_KILL, \"Failed list Syncthing processes\", e);\n+        } finally {\n+            try {\n+                if (br != null) {\n+                    br.close();\n+                }\n+                if (psOut != null) {\n+                    psOut.close();\n+                }\n+            } catch (IOException e) {\n+                Log.w(TAG_KILL, \"Failed close the psOut stream\", e);\n+            }\n+            if (ps != null) {\n+                ps.destroy();\n+            }\n+        }\n+    }\n+","path":"app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingRunnable.java","position":72,"original_position":72,"commit_id":"5f07a896782984168d8d9d9582720c10ce31c4e0","original_commit_id":"5f07a896782984168d8d9d9582720c10ce31c4e0","user":{"login":"AudriusButkevicius","id":1144861,"avatar_url":"https://avatars1.githubusercontent.com/u/1144861?v=4","gravatar_id":"","url":"https://api.github.com/users/AudriusButkevicius","html_url":"https://github.com/AudriusButkevicius","followers_url":"https://api.github.com/users/AudriusButkevicius/followers","following_url":"https://api.github.com/users/AudriusButkevicius/following{/other_user}","gists_url":"https://api.github.com/users/AudriusButkevicius/gists{/gist_id}","starred_url":"https://api.github.com/users/AudriusButkevicius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudriusButkevicius/subscriptions","organizations_url":"https://api.github.com/users/AudriusButkevicius/orgs","repos_url":"https://api.github.com/users/AudriusButkevicius/repos","events_url":"https://api.github.com/users/AudriusButkevicius/events{/privacy}","received_events_url":"https://api.github.com/users/AudriusButkevicius/received_events","type":"User","site_admin":false},"body":"Why can't this just return the pid list? Whats the purpose of storing it on the class?","created_at":"2018-05-27T18:43:33Z","updated_at":"2018-05-27T18:43:33Z","html_url":"https://github.com/syncthing/syncthing-android/pull/1102#discussion_r191085136","pull_request_url":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing-android/pulls/comments/191085136"},"html":{"href":"https://github.com/syncthing/syncthing-android/pull/1102#discussion_r191085136"},"pull_request":{"href":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102"}}},"pull_request":{"url":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102","id":190800663,"html_url":"https://github.com/syncthing/syncthing-android/pull/1102","diff_url":"https://github.com/syncthing/syncthing-android/pull/1102.diff","patch_url":"https://github.com/syncthing/syncthing-android/pull/1102.patch","issue_url":"https://api.github.com/repos/syncthing/syncthing-android/issues/1102","number":1102,"state":"open","locked":false,"title":"replace \"grep\" with java code - fixes #https://github.com/syncthing/syncthing-android/issues/887","user":{"login":"Catfriend1","id":16361913,"avatar_url":"https://avatars1.githubusercontent.com/u/16361913?v=4","gravatar_id":"","url":"https://api.github.com/users/Catfriend1","html_url":"https://github.com/Catfriend1","followers_url":"https://api.github.com/users/Catfriend1/followers","following_url":"https://api.github.com/users/Catfriend1/following{/other_user}","gists_url":"https://api.github.com/users/Catfriend1/gists{/gist_id}","starred_url":"https://api.github.com/users/Catfriend1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Catfriend1/subscriptions","organizations_url":"https://api.github.com/users/Catfriend1/orgs","repos_url":"https://api.github.com/users/Catfriend1/repos","events_url":"https://api.github.com/users/Catfriend1/events{/privacy}","received_events_url":"https://api.github.com/users/Catfriend1/received_events","type":"User","site_admin":false},"body":"Purpose\r\nThis PR is intended to fix issue https://github.com/syncthing/syncthing-android/issues/887 by replacing the  \"grep\" in \"ps | grep\" shell code with java code in SyncthingRunnable.\r\n\r\nTesting\r\nVerified working on Android 7.1.2 LineAgeOS, device lg-h815. (Syncthing PID Found and Syncting PID #... killed lines are issued correctly in log) Used commit https://github.com/Catfriend1/syncthing-android/commit/5f07a896782984168d8d9d9582720c10ce31c4e0 to verify.\r\n\r\nNot covered by Testing\r\nI cannot test with Android ZenUI (on this platform the issue was originally reported). I can just confirm that \"grep\" is no longer necessary. This should be done by @joe147 @Joe7new .","created_at":"2018-05-27T18:31:51Z","updated_at":"2018-05-27T18:43:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4fd5f28a4aaf7227deb045e0d17656606e0f394","assignee":{"login":"Catfriend1","id":16361913,"avatar_url":"https://avatars1.githubusercontent.com/u/16361913?v=4","gravatar_id":"","url":"https://api.github.com/users/Catfriend1","html_url":"https://github.com/Catfriend1","followers_url":"https://api.github.com/users/Catfriend1/followers","following_url":"https://api.github.com/users/Catfriend1/following{/other_user}","gists_url":"https://api.github.com/users/Catfriend1/gists{/gist_id}","starred_url":"https://api.github.com/users/Catfriend1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Catfriend1/subscriptions","organizations_url":"https://api.github.com/users/Catfriend1/orgs","repos_url":"https://api.github.com/users/Catfriend1/repos","events_url":"https://api.github.com/users/Catfriend1/events{/privacy}","received_events_url":"https://api.github.com/users/Catfriend1/received_events","type":"User","site_admin":false},"assignees":[{"login":"Catfriend1","id":16361913,"avatar_url":"https://avatars1.githubusercontent.com/u/16361913?v=4","gravatar_id":"","url":"https://api.github.com/users/Catfriend1","html_url":"https://github.com/Catfriend1","followers_url":"https://api.github.com/users/Catfriend1/followers","following_url":"https://api.github.com/users/Catfriend1/following{/other_user}","gists_url":"https://api.github.com/users/Catfriend1/gists{/gist_id}","starred_url":"https://api.github.com/users/Catfriend1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Catfriend1/subscriptions","organizations_url":"https://api.github.com/users/Catfriend1/orgs","repos_url":"https://api.github.com/users/Catfriend1/repos","events_url":"https://api.github.com/users/Catfriend1/events{/privacy}","received_events_url":"https://api.github.com/users/Catfriend1/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"capi","id":254852,"avatar_url":"https://avatars3.githubusercontent.com/u/254852?v=4","gravatar_id":"","url":"https://api.github.com/users/capi","html_url":"https://github.com/capi","followers_url":"https://api.github.com/users/capi/followers","following_url":"https://api.github.com/users/capi/following{/other_user}","gists_url":"https://api.github.com/users/capi/gists{/gist_id}","starred_url":"https://api.github.com/users/capi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/capi/subscriptions","organizations_url":"https://api.github.com/users/capi/orgs","repos_url":"https://api.github.com/users/capi/repos","events_url":"https://api.github.com/users/capi/events{/privacy}","received_events_url":"https://api.github.com/users/capi/received_events","type":"User","site_admin":false},{"login":"Nutomic","id":1044450,"avatar_url":"https://avatars1.githubusercontent.com/u/1044450?v=4","gravatar_id":"","url":"https://api.github.com/users/Nutomic","html_url":"https://github.com/Nutomic","followers_url":"https://api.github.com/users/Nutomic/followers","following_url":"https://api.github.com/users/Nutomic/following{/other_user}","gists_url":"https://api.github.com/users/Nutomic/gists{/gist_id}","starred_url":"https://api.github.com/users/Nutomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nutomic/subscriptions","organizations_url":"https://api.github.com/users/Nutomic/orgs","repos_url":"https://api.github.com/users/Nutomic/repos","events_url":"https://api.github.com/users/Nutomic/events{/privacy}","received_events_url":"https://api.github.com/users/Nutomic/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102/commits","review_comments_url":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102/comments","review_comment_url":"https://api.github.com/repos/syncthing/syncthing-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/syncthing/syncthing-android/issues/1102/comments","statuses_url":"https://api.github.com/repos/syncthing/syncthing-android/statuses/5f07a896782984168d8d9d9582720c10ce31c4e0","head":{"label":"Catfriend1:replaceGrep","ref":"replaceGrep","sha":"5f07a896782984168d8d9d9582720c10ce31c4e0","user":{"login":"Catfriend1","id":16361913,"avatar_url":"https://avatars1.githubusercontent.com/u/16361913?v=4","gravatar_id":"","url":"https://api.github.com/users/Catfriend1","html_url":"https://github.com/Catfriend1","followers_url":"https://api.github.com/users/Catfriend1/followers","following_url":"https://api.github.com/users/Catfriend1/following{/other_user}","gists_url":"https://api.github.com/users/Catfriend1/gists{/gist_id}","starred_url":"https://api.github.com/users/Catfriend1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Catfriend1/subscriptions","organizations_url":"https://api.github.com/users/Catfriend1/orgs","repos_url":"https://api.github.com/users/Catfriend1/repos","events_url":"https://api.github.com/users/Catfriend1/events{/privacy}","received_events_url":"https://api.github.com/users/Catfriend1/received_events","type":"User","site_admin":false},"repo":{"id":104175272,"name":"syncthing-android","full_name":"Catfriend1/syncthing-android","owner":{"login":"Catfriend1","id":16361913,"avatar_url":"https://avatars1.githubusercontent.com/u/16361913?v=4","gravatar_id":"","url":"https://api.github.com/users/Catfriend1","html_url":"https://github.com/Catfriend1","followers_url":"https://api.github.com/users/Catfriend1/followers","following_url":"https://api.github.com/users/Catfriend1/following{/other_user}","gists_url":"https://api.github.com/users/Catfriend1/gists{/gist_id}","starred_url":"https://api.github.com/users/Catfriend1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Catfriend1/subscriptions","organizations_url":"https://api.github.com/users/Catfriend1/orgs","repos_url":"https://api.github.com/users/Catfriend1/repos","events_url":"https://api.github.com/users/Catfriend1/events{/privacy}","received_events_url":"https://api.github.com/users/Catfriend1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Catfriend1/syncthing-android","description":"Wrapper of syncthing for Android.","fork":true,"url":"https://api.github.com/repos/Catfriend1/syncthing-android","forks_url":"https://api.github.com/repos/Catfriend1/syncthing-android/forks","keys_url":"https://api.github.com/repos/Catfriend1/syncthing-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Catfriend1/syncthing-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Catfriend1/syncthing-android/teams","hooks_url":"https://api.github.com/repos/Catfriend1/syncthing-android/hooks","issue_events_url":"https://api.github.com/repos/Catfriend1/syncthing-android/issues/events{/number}","events_url":"https://api.github.com/repos/Catfriend1/syncthing-android/events","assignees_url":"https://api.github.com/repos/Catfriend1/syncthing-android/assignees{/user}","branches_url":"https://api.github.com/repos/Catfriend1/syncthing-android/branches{/branch}","tags_url":"https://api.github.com/repos/Catfriend1/syncthing-android/tags","blobs_url":"https://api.github.com/repos/Catfriend1/syncthing-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Catfriend1/syncthing-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Catfriend1/syncthing-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/Catfriend1/syncthing-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Catfriend1/syncthing-android/statuses/{sha}","languages_url":"https://api.github.com/repos/Catfriend1/syncthing-android/languages","stargazers_url":"https://api.github.com/repos/Catfriend1/syncthing-android/stargazers","contributors_url":"https://api.github.com/repos/Catfriend1/syncthing-android/contributors","subscribers_url":"https://api.github.com/repos/Catfriend1/syncthing-android/subscribers","subscription_url":"https://api.github.com/repos/Catfriend1/syncthing-android/subscription","commits_url":"https://api.github.com/repos/Catfriend1/syncthing-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/Catfriend1/syncthing-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/Catfriend1/syncthing-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/Catfriend1/syncthing-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/Catfriend1/syncthing-android/contents/{+path}","compare_url":"https://api.github.com/repos/Catfriend1/syncthing-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Catfriend1/syncthing-android/merges","archive_url":"https://api.github.com/repos/Catfriend1/syncthing-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Catfriend1/syncthing-android/downloads","issues_url":"https://api.github.com/repos/Catfriend1/syncthing-android/issues{/number}","pulls_url":"https://api.github.com/repos/Catfriend1/syncthing-android/pulls{/number}","milestones_url":"https://api.github.com/repos/Catfriend1/syncthing-android/milestones{/number}","notifications_url":"https://api.github.com/repos/Catfriend1/syncthing-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Catfriend1/syncthing-android/labels{/name}","releases_url":"https://api.github.com/repos/Catfriend1/syncthing-android/releases{/id}","deployments_url":"https://api.github.com/repos/Catfriend1/syncthing-android/deployments","created_at":"2017-09-20T06:30:30Z","updated_at":"2018-05-27T13:37:19Z","pushed_at":"2018-05-27T18:41:03Z","git_url":"git://github.com/Catfriend1/syncthing-android.git","ssh_url":"git@github.com:Catfriend1/syncthing-android.git","clone_url":"https://github.com/Catfriend1/syncthing-android.git","svn_url":"https://github.com/Catfriend1/syncthing-android","homepage":"https://syncthing.net/","size":9616,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"syncthing:master","ref":"master","sha":"ec626cd9fe052d035be04354da94e7377ea55bdf","user":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars0.githubusercontent.com/u/7628018?v=4","gravatar_id":"","url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"repo":{"id":17089728,"name":"syncthing-android","full_name":"syncthing/syncthing-android","owner":{"login":"syncthing","id":7628018,"avatar_url":"https://avatars0.githubusercontent.com/u/7628018?v=4","gravatar_id":"","url":"https://api.github.com/users/syncthing","html_url":"https://github.com/syncthing","followers_url":"https://api.github.com/users/syncthing/followers","following_url":"https://api.github.com/users/syncthing/following{/other_user}","gists_url":"https://api.github.com/users/syncthing/gists{/gist_id}","starred_url":"https://api.github.com/users/syncthing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syncthing/subscriptions","organizations_url":"https://api.github.com/users/syncthing/orgs","repos_url":"https://api.github.com/users/syncthing/repos","events_url":"https://api.github.com/users/syncthing/events{/privacy}","received_events_url":"https://api.github.com/users/syncthing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/syncthing/syncthing-android","description":"Wrapper of syncthing for Android.","fork":false,"url":"https://api.github.com/repos/syncthing/syncthing-android","forks_url":"https://api.github.com/repos/syncthing/syncthing-android/forks","keys_url":"https://api.github.com/repos/syncthing/syncthing-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/syncthing/syncthing-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/syncthing/syncthing-android/teams","hooks_url":"https://api.github.com/repos/syncthing/syncthing-android/hooks","issue_events_url":"https://api.github.com/repos/syncthing/syncthing-android/issues/events{/number}","events_url":"https://api.github.com/repos/syncthing/syncthing-android/events","assignees_url":"https://api.github.com/repos/syncthing/syncthing-android/assignees{/user}","branches_url":"https://api.github.com/repos/syncthing/syncthing-android/branches{/branch}","tags_url":"https://api.github.com/repos/syncthing/syncthing-android/tags","blobs_url":"https://api.github.com/repos/syncthing/syncthing-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/syncthing/syncthing-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/syncthing/syncthing-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/syncthing/syncthing-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/syncthing/syncthing-android/statuses/{sha}","languages_url":"https://api.github.com/repos/syncthing/syncthing-android/languages","stargazers_url":"https://api.github.com/repos/syncthing/syncthing-android/stargazers","contributors_url":"https://api.github.com/repos/syncthing/syncthing-android/contributors","subscribers_url":"https://api.github.com/repos/syncthing/syncthing-android/subscribers","subscription_url":"https://api.github.com/repos/syncthing/syncthing-android/subscription","commits_url":"https://api.github.com/repos/syncthing/syncthing-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/syncthing/syncthing-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/syncthing/syncthing-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/syncthing/syncthing-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/syncthing/syncthing-android/contents/{+path}","compare_url":"https://api.github.com/repos/syncthing/syncthing-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/syncthing/syncthing-android/merges","archive_url":"https://api.github.com/repos/syncthing/syncthing-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/syncthing/syncthing-android/downloads","issues_url":"https://api.github.com/repos/syncthing/syncthing-android/issues{/number}","pulls_url":"https://api.github.com/repos/syncthing/syncthing-android/pulls{/number}","milestones_url":"https://api.github.com/repos/syncthing/syncthing-android/milestones{/number}","notifications_url":"https://api.github.com/repos/syncthing/syncthing-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/syncthing/syncthing-android/labels{/name}","releases_url":"https://api.github.com/repos/syncthing/syncthing-android/releases{/id}","deployments_url":"https://api.github.com/repos/syncthing/syncthing-android/deployments","created_at":"2014-02-22T17:15:19Z","updated_at":"2018-05-26T15:44:48Z","pushed_at":"2018-05-27T18:43:01Z","git_url":"git://github.com/syncthing/syncthing-android.git","ssh_url":"git@github.com:syncthing/syncthing-android.git","clone_url":"https://github.com/syncthing/syncthing-android.git","svn_url":"https://github.com/syncthing/syncthing-android","homepage":"https://syncthing.net/","size":9598,"stargazers_count":888,"watchers_count":888,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":160,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":160,"open_issues":42,"watchers":888,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102"},"html":{"href":"https://github.com/syncthing/syncthing-android/pull/1102"},"issue":{"href":"https://api.github.com/repos/syncthing/syncthing-android/issues/1102"},"comments":{"href":"https://api.github.com/repos/syncthing/syncthing-android/issues/1102/comments"},"review_comments":{"href":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102/comments"},"review_comment":{"href":"https://api.github.com/repos/syncthing/syncthing-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/syncthing/syncthing-android/pulls/1102/commits"},"statuses":{"href":"https://api.github.com/repos/syncthing/syncthing-android/statuses/5f07a896782984168d8d9d9582720c10ce31c4e0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"AudriusButkevicius"}}