{"id":305446,"date":"2020-06-16T15:01:39","date_gmt":"2020-06-16T15:01:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305446"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305446","title":{"rendered":"\u041a\u0430\u043a \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u0432\u0440\u0435\u0434\u0435 \u0434\u043e\u043b\u0433\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0430\u0443\u0434\u0438\u043e (Android)"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/506870\/\">\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043c\u043d\u043e\u0433\u0438\u0435, \u043a\u0442\u043e \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u043c\u0443\u0437\u044b\u043a\u0443 (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e) \u0441 Android-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_i\/gk\/oa\/_igkoaiik88g5pr8eooiezni-i8.png\"><\/div>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435, \u0438 \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u0438 \u0430\u0443\u0434\u0438\u043e \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u043d\u0430\u0443\u0448\u043d\u0438\u043a\u0438\/\u043a\u043e\u043b\u043e\u043d\u043a\u0438). \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435: \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0441\u043b\u0443\u0448\u0430\u0435\u0442\u0435 \u043c\u0443\u0437\u044b\u043a\u0443 \u0432 \u043d\u0430\u0443\u0448\u043d\u0438\u043a\u0430\u0445, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0440\u043e\u043c\u043a\u0443\u044e. \u0412\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0437\u0432\u0443\u043a \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0442\u0438\u0448\u0435. \u0412\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0430 \u043a\u043e\u0440\u043f\u0443\u0441\u0435, \u043d\u043e \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442. \u0414\u043e\u0441\u0442\u0430\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u0437 \u043a\u0430\u0440\u043c\u0430\u043d\u0430 \u0438 \u0441\u043d\u044f\u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443, \u0432\u044b \u0438 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0422\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u044f \u0441 \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<p>  \u0414\u0430, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0435, \u043d\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u0432 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0438\u043d\u043e\u0433\u0434\u0430 \u0441\u0430\u043c\u044b\u0439 \u043d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439: \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0435\/\u0437\u0430 \u0440\u0443\u043b\u0451\u043c\/\u0437\u0438\u043c\u043e\u0439 \u043d\u0430 \u0443\u043b\u0438\u0446\u0435\/\u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0433\u0440\u044f\u0437\u043d\u044b\u0435 \u0440\u0443\u043a\u0438 \u0438 \u0442.\u0434. \u0414\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0441\u043d\u0438\u043c\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443, \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c, \u043a\u043b\u0430\u0441\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. \u0410 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u0430 \u043d\u0435 \u043d\u0430\u0443\u0448\u043d\u0438\u043a\u0438, \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u043c\u0435\u0441\u0442\u043d\u043e.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442<\/h3>\n<p>  \u0414\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u2014 \u043d\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u0430 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0412\u0441\u0451 \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 <a href=\"https:\/\/www.who.int\/publications-detail\/safe-listening-devices-and-systems-a-who-itu-standard\" rel=\"nofollow\">WHO-ETU \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442<\/a> \u201c\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f\u201d (safe listening). \u0412 \u0435\u0432\u0440\u043e\u043f\u0435\u0439\u0441\u043a\u0438\u0445 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0430\u0445 \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0434\u043e\u043b\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0438\u0441\u043a\u043e\u043c \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0445\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0432\u0437\u0440\u043e\u0441\u043b\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430\u044f \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u201c\u0434\u043e\u0437\u0430\u201d \u0437\u0432\u0443\u043a\u0430 \u2014 1.6 Pa<sup>2<\/sup>h, \u0447\u0442\u043e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e 20 \u0447\u0430\u0441\u0430\u043c \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438 83 dB.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lf\/lm\/xx\/lflmxxcutic2hsnxzyh2i_mepyg.png\"><\/div>\n<p>  <\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 mcc (mobile country code), \u0440\u0435\u0436\u0438\u043c safe listening \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <code>R.bool.config_safe_media_volume_enabled<\/code>.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0440\u0435\u0436\u0438\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d, \u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438 (\u0432\u044b\u0448\u0435 85 dB), \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <b><code>Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS<\/code><\/b>. \u041a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 20 \u0447\u0430\u0441\u043e\u0432, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u044f \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0438 \u043f\u043e\u0434\u0441\u0447\u0451\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<p>  \u0422\u0430\u043a\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0430\u043b \u044d\u0442\u0438 20 \u0447\u0430\u0441\u043e\u0432: \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0430 \u043f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439, \u0430, \u043c\u043e\u0436\u0435\u0442, \u0441\u043b\u0443\u0448\u0430\u043b \u043f\u043e 6-7 \u043c\u0438\u043d\u0443\u0442 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0433\u043e\u0434\u0430 (\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u044d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0433\u0440\u043e\u0437\u043e\u0439 \u0434\u043b\u044f \u0441\u043b\u0443\u0445\u0430). <\/p>\n<p>  \u041b\u043e\u0433\u0438\u043a\u0430 safe listening \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d\u0430 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u0435 <a href=\"https:\/\/android.googlesource.com\/platform\/frameworks\/base\/+\/refs\/heads\/android10-c2f2-release\/services\/core\/java\/com\/android\/server\/audio\/AudioService.java\" rel=\"nofollow\">AudioService.java<\/a>, \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"java\">\/\/ mMusicActiveMs is the cumulative time of music activity since safe volume was disabled. \/\/ When this time reaches UNSAFE_VOLUME_MUSIC_ACTIVE_MS_MAX, the safe media volume is re-enabled \/\/ automatically. mMusicActiveMs is rounded to a multiple of MUSIC_ACTIVE_POLL_PERIOD_MS. private int mMusicActiveMs; private static final int UNSAFE_VOLUME_MUSIC_ACTIVE_MS_MAX = (20 * 3600 * 1000); \/\/ 20 hours private static final int MUSIC_ACTIVE_POLL_PERIOD_MS = 60000;  \/\/ 1 minute polling interval<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0435 <code>mMusicActiveMs <\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0447\u0438\u0441\u043b\u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0438\u0430\u043b\u043e\u0433\u0430. \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <b><code>Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS<\/code><\/b>. \u0412 \u044d\u0442\u0443 \u0436\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043a\u0430\u0436\u0434\u0443\u044e \u043c\u0438\u043d\u0443\u0442\u0443 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 mMusicActiveMs.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0435 <code>mSafeMediaVolumeState<\/code>, \u043e\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b safe listening: <\/p>\n<ul>\n<li><code>DISABLED<\/code>: \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0430<\/li>\n<li><code>ACTIVE<\/code>: \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043b\u0438\u043c\u0438\u0442 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0435\u043b\u044c\u0437\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u044c, \u043f\u043e\u043a\u0430 \u043e\u043d \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c<\/li>\n<li><code>INACTIVE<\/code>: \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430, \u043b\u0438\u043c\u0438\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"java\"> \/\/ mSafeMediaVolumeState indicates whether the media volume is limited over headphones. \/\/ It is SAFE_MEDIA_VOLUME_NOT_CONFIGURED at boot time until a network service is connected \/\/ or the configure time is elapsed. It is then set to SAFE_MEDIA_VOLUME_ACTIVE or \/\/ SAFE_MEDIA_VOLUME_DISABLED according to country option. If not SAFE_MEDIA_VOLUME_DISABLED, it \/\/ can be set to SAFE_MEDIA_VOLUME_INACTIVE by calling AudioService.disableSafeMediaVolume() \/\/ (when user opts out). private static final int SAFE_MEDIA_VOLUME_NOT_CONFIGURED = 0; private static final int SAFE_MEDIA_VOLUME_DISABLED = 1; private static final int SAFE_MEDIA_VOLUME_INACTIVE = 2;  \/\/ confirmed private static final int SAFE_MEDIA_VOLUME_ACTIVE = 3;  \/\/ unconfirmed private Integer mSafeMediaVolumeState;<\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043b\u0438\u043c\u0438\u0442\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"java\">private void onCheckMusicActive(String caller) {    synchronized (mSafeMediaVolumeState) {        if (mSafeMediaVolumeState == SAFE_MEDIA_VOLUME_INACTIVE) {            int device = getDeviceForStream(AudioSystem.STREAM_MUSIC);             if ((device &amp; mSafeMediaVolumeDevices) != 0) {                sendMsg(mAudioHandler,                    MSG_CHECK_MUSIC_ACTIVE,                    SENDMSG_REPLACE,                    0,                    0,                    caller,                    MUSIC_ACTIVE_POLL_PERIOD_MS);                int index = mStreamStates[AudioSystem.STREAM_MUSIC].getIndex(device);                if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0) &amp;&amp;                    (index &gt; safeMediaVolumeIndex(device))) {                    \/\/ Approximate cumulative active music time                    mMusicActiveMs += MUSIC_ACTIVE_POLL_PERIOD_MS;                    if (mMusicActiveMs &gt; UNSAFE_VOLUME_MUSIC_ACTIVE_MS_MAX) {                        setSafeMediaVolumeEnabled(true, caller);                        mMusicActiveMs = 0;                    }                    saveMusicActiveMs();                }            }        }    } } <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041a\u0430\u043a \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c safe listening, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>mSafeMediaVolumeState<\/code> \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>DISABLED<\/code>.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0433\u0434\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"java\">private void onConfigureSafeVolume(boolean force, String caller) {    ...    boolean safeMediaVolumeEnabled =            SystemProperties.getBoolean(&quot;audio.safemedia.force&quot;, false)                    || mContext.getResources().getBoolean(                  com.android.internal.R.bool.config_safe_media_volume_enabled);     boolean safeMediaVolumeBypass =            SystemProperties.getBoolean(&quot;audio.safemedia.bypass&quot;, false);     int persistedState;    if (safeMediaVolumeEnabled &amp;&amp; !safeMediaVolumeBypass) {        persistedState = SAFE_MEDIA_VOLUME_ACTIVE;        \/* \u0415\u0449\u0451 \u043a\u043e\u0434, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0449\u0438\u0439 mSafeMediaVolumeState \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u0438\u0431\u043e ACTIVE, \u043b\u0438\u0431\u043e INACTIVE *\/ ...    } else {        persistedState = SAFE_MEDIA_VOLUME_DISABLED;        mSafeMediaVolumeState = SAFE_MEDIA_VOLUME_DISABLED;    }<\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043c\u0438\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <code>R.bool.config_safe_media_volume_enabled<\/code>, \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c\/\u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 safe listening: <b>audio.safemedia.force<\/b> \u0438 <b>audio.safemedia.bypass<\/b>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435, \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>audio.safemedia.bypass=true<\/b> \u0432 \u0444\u0430\u0439\u043b\u0435 <b>system\/build.properties<\/b>. \u041d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u044b root-\u043f\u0440\u0430\u0432\u0430. \u0415\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431.<\/p>\n<h3>\u041a\u0430\u043a \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 root<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u041e\u041a, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u044d\u0442\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438:<\/p>\n<pre><code class=\"java\">@Override     public void onClick(DialogInterface dialog, int which) {         mAudioManager.disableSafeMediaVolume();     } <\/code><\/pre>\n<p>  \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>disableSafeMediaVolume<\/code> \u0443 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 <code>AudioManager<\/code>. <\/p>\n<pre><code class=\"java\">\/** * Only useful for volume controllers. * @hide *\/ public void disableSafeMediaVolume() { \u2026 }<\/code><\/pre>\n<p>  \u041e\u043d \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@hide<\/code>. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0451\u043d \u0432 public API \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 public. \u0414\u043e Android 9 \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0435\u0444\u043b\u0435\u043a\u0448\u043d. \u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c, \u043d\u043e \u0443\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u044e\u043a\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/www.xda-developers.com\/android-development-bypass-hidden-api-restrictions\/\" rel=\"nofollow\">double-reflection<\/a>:<\/p>\n<pre><code class=\"kotlin\">val audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager val getDeclaredMethod = Class::class.java.getDeclaredMethod(&quot;getDeclaredMethod&quot;, String::class.java, arrayOf&lt;Class&lt;*&gt;&gt;()::class.java) val disableSafeMediaVolumeMethod = getDeclaredMethod.invoke(AudioManager::class.java, &quot;disableSafeMediaVolume&quot;, arrayOf&lt;Class&lt;*&gt;&gt;()) as Method disableSafeMediaVolumeMethod.invoke(audioManager) <\/code><\/pre>\n<p>  \u0412\u044b\u0437\u043e\u0432 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c<br \/>  <code>java.lang.SecurityException: Only SystemUI can disable the safe media volume: Neither user 10307 nor current process has android.permission.STATUS_BAR_SERVICE.<\/code><br \/>  \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 STATUS_BAR_SERVICE \u0438\u043c\u0435\u0435\u0442 protectionLevel=\u00absignature|privileged\u00bb, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>  \u0427\u0442\u043e \u0436, \u0442\u043e\u0433\u0434\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u0430\u043a. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <b><code>Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS<\/code><\/b>, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>mMusicActiveMs<\/code>. \u041a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u043d\u0451\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u0442\u044c\u0441\u044f \u043a 20 \u0447\u0430\u0441\u0430\u043c, \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c. \u0417\u0430\u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b AudioService \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<p>  \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b><code>Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS<\/code><\/b> \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">val unsafeMs = Settings.Secure.getInt(contentResolver, &quot;unsafe_volume_music_active_ms&quot;)<\/code><\/pre>\n<p>  \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f adb:<\/p>\n<pre><code class=\"bash\"> adb shell settings get secure unsafe_volume_music_active_ms<\/code><\/pre>\n<p>  \u0410 \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 <code>android.permission.WRITE_SECURE_SETTINGS<\/code>.<\/p>\n<p>  \u041e\u043d\u043e \u0438\u043c\u0435\u0435\u0442 protectionLevel=\u00absignature|privileged|<b>development<\/b>\u00bb, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f adb:<\/p>\n<pre><code class=\"bash\">adb shell pm grant com.example.app android.permission.WRITE_SECURE_SETTINGS<\/code><\/pre>\n<p>  \u0421\u0430\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"kotlin\">Settings.Secure.putInt(contentResolver, &quot;unsafe_volume_music_active_ms&quot; , 1) <\/code><\/pre>\n<p>  \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e adb:<\/p>\n<pre><code class=\"bash\">adb shell settings put secure unsafe_volume_music_active_ms 1<\/code><\/pre>\n<p>  \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u0432 1, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 AudioManager, \u0430 \u043d\u0435 \u0432 0. \u0422\u0430\u043a \u043a\u0430\u043a 0 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e ACTIVE. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b AudioService \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>mMusicActiveMs<\/code>.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 <a href=\"https:\/\/android.googlesource.com\/platform\/frameworks\/base\/+\/refs\/heads\/android10-c2f2-release\/media\/java\/android\/media\/AudioManager.java\" rel=\"nofollow\">AudioManager.java<\/a><\/p>\n<pre><code class=\"java\">\/** *  @hide *  Reload audio settings. This method is called by Settings backup *  agent when audio settings are restored and causes the AudioService *  to read and apply restored settings. *\/ public void reloadAudioSettings() {    \u2026 }<\/code><\/pre>\n<p>  \u041e\u043d \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 <code>readAudioSettings <\/code>\u0432 <code>AudioService<\/code>, \u0433\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 <code>mMusicActiveMs <\/code>\u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<pre><code class=\"java\">private void readAudioSettings(boolean userSwitch) { ... synchronized (mSafeMediaVolumeStateLock) {         mMusicActiveMs = MathUtils.constrain(Settings.Secure.getIntForUser(mContentResolver,                 Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS, 0, UserHandle.USER_CURRENT),                 0, UNSAFE_VOLUME_MUSIC_ACTIVE_MS_MAX);         if (mSafeMediaVolumeState == SAFE_MEDIA_VOLUME_ACTIVE) {             enforceSafeMediaVolume(TAG);         }  }<\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@hide<\/code>. \u0415\u0433\u043e \u0432\u044b\u0437\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.xda-developers.com\/android-development-bypass-hidden-api-restrictions\/\" rel=\"nofollow\">double-reflection<\/a> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435:<br \/>  java.lang.SecurityException: Permission Denial: get\/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL<br \/>  \u0414\u0430, \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <code>@hide<\/code> \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u043d\u0435\u0441\u043f\u0440\u043e\u0441\u0442\u0430. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u043c. \u041e\u043d\u043e \u0438\u043c\u0435\u0435\u0442 protectionLevel=\u00absignature|installer\u00bb.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c AudioService \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a. \u041f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435\u043b\u044c\u0437\u044f. \u041d\u0443\u0436\u043d\u043e \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0442\u0435\u043e\u0440\u0438\u044e.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <code>unsafe_volume_music_active_ms = 71 990 000<\/code> (\u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f 10 \u0441\u0435\u043a\u0443\u043d\u0434, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u044c \u043c\u0443\u0437\u044b\u043a\u0443 \u043d\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438)<\/p>\n<pre><code class=\"bash\">adb shell settings put secure unsafe_volume_music_active_ms 71990000<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u043c\u043e\u0436\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f):<\/p>\n<pre><code class=\"bash\">adb reboot<\/code><\/pre>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430\u0443\u0448\u043d\u0438\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0443 \u043f\u043e\u0433\u0440\u043e\u043c\u0447\u0435. \u0412 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u0438\u043d\u0443\u0442\u044b \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0430\u043b\u043e\u0433.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0442\u0435 \u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043d\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c unsafe_volume_music_active_ms = 1. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0443, \u0436\u0434\u0451\u043c \u043c\u0438\u043d\u0443\u0442\u0443. \u0414\u0438\u0430\u043b\u043e\u0433 \u043d\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u0418\u0442\u043e\u0433\u0438<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <b>\u041f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 root-\u043f\u0440\u0430\u0432<\/b><\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 audio.safemedia.bypass=true \u0432 \u0444\u0430\u0439\u043b\u0435 system\/build.properties<\/p>\n<p>  <b>\u0411\u0435\u0437 root-\u043f\u0440\u0430\u0432<\/b><\/p>\n<p>  \u041d\u0443\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <b><code>Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS<\/code><\/b>, \u0438 \u043d\u0435 \u0434\u0430\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0448\u0435 72 000 000 (20 \u0447\u0430\u0441\u043e\u0432). \u041f\u043e\u0441\u043b\u0435 \u0441\u0431\u0440\u043e\u0441\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e).<\/p>\n<p>  \u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0430 <a href=\"https:\/\/github.com\/seamirage\/VolumeControl\" rel=\"nofollow\">\u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u0443, \u0438 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\/\u043f\u0435\u0440\u0435\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f.<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/506870\/\"> https:\/\/habr.com\/ru\/post\/506870\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/506870\/\">\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043c\u043d\u043e\u0433\u0438\u0435, \u043a\u0442\u043e \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u043c\u0443\u0437\u044b\u043a\u0443 (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e) \u0441 Android-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_i\/gk\/oa\/_igkoaiik88g5pr8eooiezni-i8.png\"><\/div>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435, \u0438 \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-305446","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305446"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305446\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}