{"action":"created","issue":{"url":"https://api.github.com/repos/appium/appium-uiautomator2-server/issues/129","repository_url":"https://api.github.com/repos/appium/appium-uiautomator2-server","labels_url":"https://api.github.com/repos/appium/appium-uiautomator2-server/issues/129/labels{/name}","comments_url":"https://api.github.com/repos/appium/appium-uiautomator2-server/issues/129/comments","events_url":"https://api.github.com/repos/appium/appium-uiautomator2-server/issues/129/events","html_url":"https://github.com/appium/appium-uiautomator2-server/pull/129","id":310024721,"number":129,"title":"fix to run clip feature on runOnMainSync","user":{"login":"KazuCocoa","id":5511591,"avatar_url":"https://avatars3.githubusercontent.com/u/5511591?v=4","gravatar_id":"","url":"https://api.github.com/users/KazuCocoa","html_url":"https://github.com/KazuCocoa","followers_url":"https://api.github.com/users/KazuCocoa/followers","following_url":"https://api.github.com/users/KazuCocoa/following{/other_user}","gists_url":"https://api.github.com/users/KazuCocoa/gists{/gist_id}","starred_url":"https://api.github.com/users/KazuCocoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KazuCocoa/subscriptions","organizations_url":"https://api.github.com/users/KazuCocoa/orgs","repos_url":"https://api.github.com/users/KazuCocoa/repos","events_url":"https://api.github.com/users/KazuCocoa/events{/privacy}","received_events_url":"https://api.github.com/users/KazuCocoa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-30T09:45:22Z","updated_at":"2018-03-30T16:48:51Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/appium/appium-uiautomator2-server/pulls/129","html_url":"https://github.com/appium/appium-uiautomator2-server/pull/129","diff_url":"https://github.com/appium/appium-uiautomator2-server/pull/129.diff","patch_url":"https://github.com/appium/appium-uiautomator2-server/pull/129.patch"},"body":"related: https://github.com/appium/ruby_lib_core/pull/69#issuecomment-377466959\r\n\r\nWhen I ran clip feature against Andorid, I encounterd the below error. To avoid the error, I've implemented `runOnMainSync` to run clip feature on main thread.\r\n\r\nAfter this PR, ruby_lib_core's tests run perfectly for clip features on Android.\r\n\r\n```\r\njava.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()\r\n  at android.os.Handler.<init>(Handler.java:209)\r\n  at android.os.Handler.<init>(Handler.java:123)\r\n  at android.content.ClipboardManager$2.<init>(ClipboardManager.java:69)\r\n  at android.content.ClipboardManager.<init>(ClipboardManager.java:69)\r\n  at android.app.SystemServiceRegistry$12.createService(SystemServiceRegistry.java:276)\r\n  at android.app.SystemServiceRegistry$12.createService(SystemServiceRegistry.java:275)\r\n  at android.app.SystemServiceRegistry$CachedServiceFetcher.getService(SystemServiceRegistry.java:884)\r\n  at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java:837)\r\n  at android.app.ContextImpl.getSystemService(ContextImpl.java:1370)\r\n  at io.appium.uiautomator2.utils.ClipboardHelper.getManager(ClipboardHelper.java:37)\r\n  at io.appium.uiautomator2.utils.ClipboardHelper.getTextData(ClipboardHelper.java:45)\r\n  at io.appium.uiautomator2.handler.GetClipboard.safeHandle(GetClipboard.java:61)\r\n  at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:56)\r\n  at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:238)\r\n  at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:229)\r\n  at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\r\n  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)\r\n  at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\r\n  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)\r\n  at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)\r\n  at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)\r\n  at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)\r\n  at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\r\n  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)\r\n  at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\r\n  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\r\n  at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)\r\n  at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)\r\n  at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)\r\n  at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:514)\r\n  at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:468)\r\n  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)\r\n  at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)\r\n  at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.jav\r\n```"},"comment":{"url":"https://api.github.com/repos/appium/appium-uiautomator2-server/issues/comments/377567776","html_url":"https://github.com/appium/appium-uiautomator2-server/pull/129#issuecomment-377567776","issue_url":"https://api.github.com/repos/appium/appium-uiautomator2-server/issues/129","id":377567776,"user":{"login":"KazuCocoa","id":5511591,"avatar_url":"https://avatars3.githubusercontent.com/u/5511591?v=4","gravatar_id":"","url":"https://api.github.com/users/KazuCocoa","html_url":"https://github.com/KazuCocoa","followers_url":"https://api.github.com/users/KazuCocoa/followers","following_url":"https://api.github.com/users/KazuCocoa/following{/other_user}","gists_url":"https://api.github.com/users/KazuCocoa/gists{/gist_id}","starred_url":"https://api.github.com/users/KazuCocoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KazuCocoa/subscriptions","organizations_url":"https://api.github.com/users/KazuCocoa/orgs","repos_url":"https://api.github.com/users/KazuCocoa/repos","events_url":"https://api.github.com/users/KazuCocoa/events{/privacy}","received_events_url":"https://api.github.com/users/KazuCocoa/received_events","type":"User","site_admin":false},"created_at":"2018-03-30T16:48:51Z","updated_at":"2018-03-30T16:48:51Z","author_association":"MEMBER","body":"finished ✅ "}}
{"actor":{"display_login":"KazuCocoa"}}