{"action":"closed","issue":{"url":"https://api.github.com/repos/aosp-mirror/platform_frameworks_base/issues/144","repository_url":"https://api.github.com/repos/aosp-mirror/platform_frameworks_base","labels_url":"https://api.github.com/repos/aosp-mirror/platform_frameworks_base/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/aosp-mirror/platform_frameworks_base/issues/144/comments","events_url":"https://api.github.com/repos/aosp-mirror/platform_frameworks_base/issues/144/events","html_url":"https://github.com/aosp-mirror/platform_frameworks_base/issues/144","id":233362949,"node_id":"MDU6SXNzdWUyMzMzNjI5NDk=","number":144,"title":"getService null exception on the intent","user":{"login":"tergabri","id":9676438,"node_id":"MDQ6VXNlcjk2NzY0Mzg=","avatar_url":"https://avatars3.githubusercontent.com/u/9676438?v=4","gravatar_id":"","url":"https://api.github.com/users/tergabri","html_url":"https://github.com/tergabri","followers_url":"https://api.github.com/users/tergabri/followers","following_url":"https://api.github.com/users/tergabri/following{/other_user}","gists_url":"https://api.github.com/users/tergabri/gists{/gist_id}","starred_url":"https://api.github.com/users/tergabri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tergabri/subscriptions","organizations_url":"https://api.github.com/users/tergabri/orgs","repos_url":"https://api.github.com/users/tergabri/repos","events_url":"https://api.github.com/users/tergabri/events{/privacy}","received_events_url":"https://api.github.com/users/tergabri/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-03T11:09:39Z","updated_at":"2018-11-05T22:08:39Z","closed_at":"2018-11-05T22:08:39Z","author_association":"NONE","body":"I found a strange behaviour in getService, in PendingIntent.java\r\n\r\n```\r\n    public static PendingIntent getService(Context context, int requestCode,\r\n            @NonNull Intent intent, @Flags int flags) {\r\n        String packageName = context.getPackageName();\r\n        String resolvedType = intent != null ? intent.resolveTypeIfNeeded(\r\n                context.getContentResolver()) : null;\r\n        try {\r\n            intent.prepareToLeaveProcess(context);\r\n            IIntentSender target =\r\n                ActivityManagerNative.getDefault().getIntentSender(\r\n                    ActivityManager.INTENT_SENDER_SERVICE, packageName,\r\n                    null, null, requestCode, new Intent[] { intent },\r\n                    resolvedType != null ? new String[] { resolvedType } : null,\r\n                    flags, null, UserHandle.myUserId());\r\n            return target != null ? new PendingIntent(target) : null;\r\n        } catch (RemoteException e) {\r\n        }\r\n        return null;\r\n    }\r\n```\r\n\r\n\r\nintent is marked as not null (@NonNull Intent intent)\r\nbut we still have this\r\n`        String resolvedType = intent != null ? intent.resolveTypeIfNeeded(\r\n                context.getContentResolver()) : null;`\r\n\r\nI think it can be removed. \r\nI can patch the code if you are happy with that.\r\n\r\n\r\nLater we have this:\r\n`            intent.prepareToLeaveProcess(context);`\r\n\r\nSo clearly it cannot be null\r\n\r\n\r\n"}}
{"actor":{"display_login":"willnorris"}}