আচরণের পরিবর্তন: Android 15 বা উচ্চতরকে লক্ষ্য করে এমন অ্যাপ

পূর্ববর্তী রিলিজের মতো, Android 15-এ এমন আচরণের পরিবর্তন অন্তর্ভুক্ত রয়েছে যা আপনার অ্যাপকে প্রভাবিত করতে পারে। নিম্নলিখিত আচরণ পরিবর্তনগুলি শুধুমাত্র Android 15 বা উচ্চতর সংস্করণগুলিকে লক্ষ্য করে এমন অ্যাপগুলিতে প্রযোজ্য৷ যদি আপনার অ্যাপটি Android 15 বা উচ্চতরকে লক্ষ্য করে থাকে, তাহলে প্রযোজ্য ক্ষেত্রে এই আচরণগুলিকে সঠিকভাবে সমর্থন করার জন্য আপনার অ্যাপটি সংশোধন করা উচিত।

আপনার অ্যাপের targetSdkVersion নির্বিশেষে Android 15-এ চলমান সমস্ত অ্যাপকে প্রভাবিত করে এমন আচরণের পরিবর্তনের তালিকাটিও পর্যালোচনা করতে ভুলবেন না।

মূল কার্যকারিতা

Android 15 অ্যান্ড্রয়েড সিস্টেমের বিভিন্ন মূল ক্ষমতাগুলিকে সংশোধন বা প্রসারিত করে।

ফোরগ্রাউন্ড পরিষেবাতে পরিবর্তন

আমরা Android 15 এর সাথে ফোরগ্রাউন্ড পরিষেবাগুলিতে নিম্নলিখিত পরিবর্তনগুলি করছি৷

ডেটা সিঙ্ক ফোরগ্রাউন্ড পরিষেবা সময় শেষ আচরণ

Android 15 Android 15 (API স্তর 35) বা উচ্চতরকে লক্ষ্য করে এমন অ্যাপগুলির জন্য dataSync একটি নতুন টাইমআউট আচরণ প্রবর্তন করে৷ এই আচরণটি নতুন mediaProcessing ফোরগ্রাউন্ড পরিষেবা প্রকারের ক্ষেত্রেও প্রযোজ্য।

সিস্টেমটি একটি অ্যাপের dataSync পরিষেবাগুলিকে 24-ঘন্টা সময়ের মধ্যে মোট 6 ঘন্টা চালানোর অনুমতি দেয়, তারপরে সিস্টেমটি চলমান পরিষেবাটির Service.onTimeout(int, int) পদ্ধতিতে কল করে (Android 15 এ চালু করা হয়েছে)৷ এই সময়ে, পরিষেবাটিতে Service.stopSelf() কল করার জন্য কয়েক সেকেন্ড সময় আছে। যখন Service.onTimeout() কল করা হয়, তখন পরিষেবাটিকে আর অগ্রভাগের পরিষেবা হিসাবে বিবেচনা করা হয় না। যদি পরিষেবাটি Service.stopSelf() কল না করে, তবে সিস্টেমটি একটি অভ্যন্তরীণ ব্যতিক্রম নিক্ষেপ করে৷ ব্যতিক্রমটি নিম্নলিখিত বার্তার সাথে লগক্যাটে লগ ইন করা হয়েছে:

Fatal Exception: android.app.RemoteServiceException: "A foreground service of
type dataSync did not stop within its timeout: [component name]"

এই আচরণ পরিবর্তনের সমস্যাগুলি এড়াতে, আপনি নিম্নলিখিতগুলির মধ্যে এক বা একাধিক করতে পারেন:

  1. আপনার পরিষেবাকে নতুন Service.onTimeout(int, int) পদ্ধতি প্রয়োগ করতে দিন। আপনার অ্যাপ কলব্যাক গ্রহণ করলে, কয়েক সেকেন্ডের মধ্যে stopSelf() কল করতে ভুলবেন না। (যদি আপনি এখনই অ্যাপটি বন্ধ না করেন তবে সিস্টেমটি একটি ব্যর্থতা তৈরি করে।)
  2. নিশ্চিত করুন যে আপনার অ্যাপের dataSync পরিষেবাগুলি যে কোনও 24-ঘণ্টার সময়ের মধ্যে মোট 6 ঘন্টার বেশি চলবে না (যদি না ব্যবহারকারী অ্যাপটির সাথে ইন্টারঅ্যাক্ট করে, টাইমার রিসেট করে)।
  3. শুধুমাত্র dataSync ফোরগ্রাউন্ড পরিষেবাগুলি সরাসরি ব্যবহারকারীর ইন্টারঅ্যাকশনের ফলে শুরু করুন; যেহেতু পরিষেবাটি শুরু হওয়ার সময় আপনার অ্যাপটি ফোরগ্রাউন্ডে থাকে, তাই অ্যাপটি ব্যাকগ্রাউন্ডে যাওয়ার পরে আপনার পরিষেবার পুরো ছয় ঘন্টা থাকে।
  4. একটি dataSync ফোরগ্রাউন্ড পরিষেবা ব্যবহার করার পরিবর্তে, একটি বিকল্প API ব্যবহার করুন৷

যদি আপনার অ্যাপের dataSync ফোরগ্রাউন্ড পরিষেবাগুলি গত 24-এর মধ্যে 6 ঘন্টা ধরে চলে থাকে, তবে ব্যবহারকারী আপনার অ্যাপটিকে ফোরগ্রাউন্ডে না আনলে আপনি অন্য dataSync ফোরগ্রাউন্ড পরিষেবা শুরু করতে পারবেন না (যা টাইমার রিসেট করে)। আপনি যদি অন্য একটি dataSync ফোরগ্রাউন্ড পরিষেবা শুরু করার চেষ্টা করেন, তাহলে সিস্টেমটি "ফোরগ্রাউন্ড সার্ভিস টাইপ ডেটাসিঙ্কের জন্য সময়সীমা ইতিমধ্যেই শেষ" এর মতো একটি ত্রুটি বার্তা সহ ForegroundServiceStartNotAllowedException ছুড়ে দেয়৷

টেস্টিং

আপনার অ্যাপের আচরণ পরীক্ষা করার জন্য, আপনি ডেটা সিঙ্ক টাইমআউট সক্ষম করতে পারেন এমনকি যদি আপনার অ্যাপ অ্যান্ড্রয়েড 15 টার্গেট না করে (যতক্ষণ অ্যাপটি একটি Android 15 ডিভাইসে চলছে)। টাইমআউট সক্ষম করতে, নিম্নলিখিত adb কমান্ডটি চালান:

adb shell am compat enable FGS_INTRODUCE_TIME_LIMITS your-package-name

আপনি টাইমআউট পিরিয়ড সামঞ্জস্য করতে পারেন, সীমা পৌঁছে গেলে আপনার অ্যাপ কীভাবে আচরণ করে তা পরীক্ষা করা সহজ করতে। একটি নতুন টাইমআউট পিরিয়ড সেট করতে, নিম্নলিখিত adb কমান্ডটি চালান:

adb shell device_config put activity_manager data_sync_fgs_timeout_duration duration-in-milliseconds

নতুন মিডিয়া প্রক্রিয়াকরণ ফোরগ্রাউন্ড পরিষেবার ধরন

Android 15 introduces a new foreground service type, mediaProcessing. This service type is appropriate for operations like transcoding media files. For example, a media app might download an audio file and need to convert it to a different format before playing it. You can use a mediaProcessing foreground service to make sure the conversion continues even while the app is in the background.

The system permits an app's mediaProcessing services to run for a total of 6 hours in a 24-hour period, after which the system calls the running service's Service.onTimeout(int, int) method (introduced in Android 15). At this time, the service has a few seconds to call Service.stopSelf(). If the service does not call Service.stopSelf(), the system throws an internal exception. The exception is logged in Logcat with the following message:

Fatal Exception: android.app.RemoteServiceException: "A foreground service of
type mediaProcessing did not stop within its timeout: [component name]"

To avoid having the exception, you can do one of the following:

  1. Have your service implement the new Service.onTimeout(int, int) method. When your app receives the callback, make sure to call stopSelf() within a few seconds. (If you don't stop the app right away, the system generates a failure.)
  2. Make sure your app's mediaProcessing services don't run for more than a total of 6 hours in any 24-hour period (unless the user interacts with the app, resetting the timer).
  3. Only start mediaProcessing foreground services as a result of direct user interaction; since your app is in the foreground when the service starts, your service has the full six hours after the app goes to the background.
  4. Instead of using a mediaProcessing foreground service, use an alternative API, like WorkManager.

If your app's mediaProcessing foreground services have run for 6 hours in the last 24, you cannot start another mediaProcessing foreground service unless the user has brought your app to the foreground (which resets the timer). If you try to start another mediaProcessing foreground service, the system throws ForegroundServiceStartNotAllowedException with an error message like "Time limit already exhausted for foreground service type mediaProcessing".

For more information about the mediaProcessing service type, see Changes to foreground service types for Android 15: Media processing.

Testing

To test your app's behavior, you can enable media processing timeouts even if your app is not targeting Android 15 (as long as the app is running on an Android 15 device). To enable timeouts, run the following adb command:

adb shell am compat enable FGS_INTRODUCE_TIME_LIMITS your-package-name

You can also adjust the timeout period, to make it easier to test how your app behaves when the limit is reached. To set a new timeout period, run the following adb command:

adb shell device_config put activity_manager media_processing_fgs_timeout_duration duration-in-milliseconds

BOOT_COMPLETED সম্প্রচার রিসিভার ফোরগ্রাউন্ড পরিষেবা চালু করার উপর নিষেধাজ্ঞা

There are new restrictions on BOOT_COMPLETED broadcast receivers launching foreground services. BOOT_COMPLETED receivers are not allowed to launch the following types of foreground services:

If a BOOT_COMPLETED receiver tries to launch any of those types of foreground services, the system throws ForegroundServiceStartNotAllowedException.

Testing

To test your app's behavior, you can enable these new restrictions even if your app is not targeting Android 15 (as long as the app is running on an Android 15 device). Run the following adb command:

adb shell am compat enable FGS_BOOT_COMPLETED_RESTRICTIONS your-package-name

To send a BOOT_COMPLETED broadcast without restarting the device, run the following adb command:

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED your-package-name

একটি অ্যাপের SYSTEM_ALERT_WINDOW অনুমতি থাকাকালীন ফোরগ্রাউন্ড পরিষেবাগুলি শুরু করার উপর বিধিনিষেধ

পূর্বে, যদি একটি অ্যাপের কাছে SYSTEM_ALERT_WINDOW অনুমতি থাকে, তবে অ্যাপটি বর্তমানে ব্যাকগ্রাউন্ডে থাকলেও এটি একটি ফোরগ্রাউন্ড পরিষেবা চালু করতে পারে (যেমন ব্যাকগ্রাউন্ড শুরু সীমাবদ্ধতা থেকে অব্যাহতি নিয়ে আলোচনা করা হয়েছে)।

যদি কোনো অ্যাপ Android 15 কে লক্ষ্য করে, তাহলে এই ছাড় এখন আরও সংকুচিত। অ্যাপটির এখন SYSTEM_ALERT_WINDOW অনুমতি থাকতে হবে এবং একটি দৃশ্যমান ওভারলে উইন্ডোও থাকতে হবে । অর্থাৎ, অ্যাপটিকে প্রথমে একটি TYPE_APPLICATION_OVERLAY উইন্ডো চালু করতে হবে এবং আপনি একটি ফোরগ্রাউন্ড পরিষেবা শুরু করার আগে উইন্ডোটি দৃশ্যমান হওয়া প্রয়োজন৷

যদি আপনার অ্যাপ এই নতুন প্রয়োজনীয়তাগুলি পূরণ না করে ব্যাকগ্রাউন্ড থেকে একটি ফোরগ্রাউন্ড পরিষেবা শুরু করার চেষ্টা করে (এবং এটিতে অন্য কিছু ছাড় নেই), সিস্টেমটি ForegroundServiceStartNotAllowedException থ্রো করে।

যদি আপনার অ্যাপটি SYSTEM_ALERT_WINDOW অনুমতি ঘোষণা করে এবং পটভূমি থেকে ফোরগ্রাউন্ড পরিষেবা চালু করে, তাহলে এটি এই পরিবর্তন দ্বারা প্রভাবিত হতে পারে। যদি আপনার অ্যাপটি একটি ForegroundServiceStartNotAllowedException পায়, তাহলে আপনার অ্যাপের ক্রিয়াকলাপের ক্রম পরীক্ষা করুন এবং নিশ্চিত করুন যে আপনার অ্যাপটি ব্যাকগ্রাউন্ড থেকে ফোরগ্রাউন্ড পরিষেবা শুরু করার চেষ্টা করার আগে ইতিমধ্যেই একটি সক্রিয় ওভারলে উইন্ডো রয়েছে৷ আপনি View.getWindowVisibility() এ কল করে আপনার ওভারলে উইন্ডোটি বর্তমানে দৃশ্যমান কিনা তা পরীক্ষা করতে পারেন, অথবা যখনই দৃশ্যমানতা পরিবর্তন হয় তখন বিজ্ঞপ্তি পেতে আপনি View.onWindowVisibilityChanged() ওভাররাইড করতে পারেন।

টেস্টিং

আপনার অ্যাপ্লিকেশানের আচরণ পরীক্ষা করার জন্য, আপনি এই নতুন বিধিনিষেধগুলি সক্ষম করতে পারেন এমনকি যদি আপনার অ্যাপটি Android 15 টার্গেট না করে (যতক্ষণ অ্যাপটি একটি Android 15 ডিভাইসে চলছে)। পটভূমি থেকে ফোরগ্রাউন্ড পরিষেবাগুলি শুরু করার জন্য এই নতুন বিধিনিষেধগুলি সক্ষম করতে, নিম্নলিখিত adb কমান্ডটি চালান:

adb shell am compat enable FGS_SAW_RESTRICTIONS your-package-name

অ্যাপ্লিকেশানগুলি কখন বিরক্ত করবে না মোডের বৈশ্বিক অবস্থা পরিবর্তন করতে পারে তার পরিবর্তন৷

Apps that target Android 15 (API level 35) and higher can no longer change the global state or policy of Do Not Disturb (DND) on a device (either by modifying user settings, or turning off DND mode). Instead, apps must contribute an AutomaticZenRule, which the system combines into a global policy with the existing most-restrictive-policy-wins scheme. Calls to existing APIs that previously affected global state (setInterruptionFilter, setNotificationPolicy) result in the creation or update of an implicit AutomaticZenRule, which is toggled on and off depending on the call-cycle of those API calls.

Note that this change only affects observable behavior if the app is calling setInterruptionFilter(INTERRUPTION_FILTER_ALL) and expects that call to deactivate an AutomaticZenRule that was previously activated by their owners.

OpenJDK API পরিবর্তন

Android 15 সর্বশেষ OpenJDK LTS রিলিজের বৈশিষ্ট্যগুলির সাথে সারিবদ্ধ করার জন্য Android এর মূল লাইব্রেরিগুলিকে রিফ্রেশ করার কাজ চালিয়ে যাচ্ছে।

এই পরিবর্তনগুলির মধ্যে কিছু Android 15 (API স্তর 35) টার্গেট করা অ্যাপগুলির জন্য অ্যাপের সামঞ্জস্যকে প্রভাবিত করতে পারে:

  • স্ট্রিং ফরম্যাটিং API-তে পরিবর্তন : নিম্নলিখিত String.format() এবং Formatter.format() API ব্যবহার করার সময় আর্গুমেন্ট ইনডেক্স, ফ্ল্যাগ, প্রস্থ এবং নির্ভুলতার বৈধতা এখন আরও কঠোর:

    উদাহরণস্বরূপ, নিম্নলিখিত ব্যতিক্রমটি ছুঁড়ে দেওয়া হয় যখন 0 এর একটি আর্গুমেন্ট সূচক ব্যবহার করা হয় ( %0 বিন্যাসে স্ট্রিং):

    IllegalFormatArgumentIndexException: Illegal format argument index = 0
    

    এই ক্ষেত্রে, 1 এর আর্গুমেন্ট ইনডেক্স ব্যবহার করে সমস্যাটি ঠিক করা যেতে পারে ( ফরম্যাট স্ট্রিংয়ে %1 )।

  • Arrays.asList(...).toArray() এর কম্পোনেন্ট টাইপের পরিবর্তন : Arrays.asList(...).toArray() ব্যবহার করার সময়, ফলাফল পাওয়া অ্যারের কম্পোনেন্ট টাইপ এখন একটি Object - অন্তর্নিহিত অ্যারের উপাদানের ধরন নয়। সুতরাং নিম্নলিখিত কোডটি একটি ClassCastException নিক্ষেপ করে:

    String[] elements = (String[]) Arrays.asList("one", "two").toArray();
    

    এই ক্ষেত্রে, String কম্পোনেন্ট টাইপ হিসাবে ফলস্বরূপ অ্যারে সংরক্ষণ করতে, আপনি পরিবর্তে Collection.toArray(Object[]) ব্যবহার করতে পারেন:

    String[] elements = Arrays.asList("two", "one").toArray(new String[0]);
    
  • ভাষা কোড পরিচালনায় পরিবর্তন : Locale API ব্যবহার করার সময়, হিব্রু, ইদ্দিশ এবং ইন্দোনেশিয়ান ভাষার কোডগুলি আর তাদের অপ্রচলিত ফর্মগুলিতে রূপান্তরিত হয় না (হিব্রু: iw , য়িদ্দিশ: ji , এবং ইন্দোনেশিয়ান: in )। এই লোকেলগুলির মধ্যে একটির জন্য ভাষা কোড নির্দিষ্ট করার সময়, পরিবর্তে ISO 639-1 থেকে কোডগুলি ব্যবহার করুন (হিব্রু: he , য়িদ্দিশ: yi , এবং ইন্দোনেশিয়ান: id )।

  • এলোমেলো int সিকোয়েন্সে পরিবর্তন : https://bugs.openjdk.org/browse/JDK-8301574 এ করা পরিবর্তনগুলি অনুসরণ করে, নিম্নলিখিত Random.ints() পদ্ধতিগুলি এখন Random.nextInt() পদ্ধতিগুলির তুলনায় সংখ্যার একটি ভিন্ন ক্রম ফেরত দেয়:

    সাধারণত, এই পরিবর্তনের ফলে অ্যাপ-ব্রেকিং আচরণ করা উচিত নয়, তবে আপনার কোড Random.ints() পদ্ধতি থেকে তৈরি হওয়া ক্রম Random.nextInt() সাথে মিলবে বলে আশা করা উচিত নয়।

আপনি Android 15 (API স্তর 35) ব্যবহার করার জন্য আপনার অ্যাপের বিল্ড কনফিগারেশনে compileSdk আপডেট করার পরে নতুন SequencedCollection API আপনার অ্যাপের সামঞ্জস্যকে প্রভাবিত করতে পারে :

  • kotlin-stdlibMutableList.removeFirst() এবং MutableList.removeLast() এক্সটেনশন ফাংশনের সাথে সংঘর্ষ

    জাভাতে List ধরনটি Kotlin-এর MutableList প্রকারে ম্যাপ করা হয়েছে। যেহেতু List.removeFirst() এবং List.removeLast() APIগুলি Android 15 (API স্তর 35) এ চালু করা হয়েছে, তাই Kotlin কম্পাইলার ফাংশন কলগুলি সমাধান করে, উদাহরণস্বরূপ list.removeFirst() , kotlin-stdlib এ এক্সটেনশন ফাংশনগুলির পরিবর্তে নতুন List APIগুলিতে স্থিরভাবে।

    যদি একটি অ্যাপ পুনরায় কম্পাইল করা হয় compileSdk 35 সেট করে এবং minSdk সেট করে 34 বা তার নিচে, এবং তারপরে অ্যাপটি Android 14 এবং তার নিচের সংস্করণে চালানো হয়, একটি রানটাইম ত্রুটি নিক্ষেপ করা হয়:

    java.lang.NoSuchMethodError: No virtual method
    removeFirst()Ljava/lang/Object; in class Ljava/util/ArrayList;
    

    Android Gradle Plugin-এ বিদ্যমান NewApi lint বিকল্পটি এই নতুন API ব্যবহারগুলি ধরতে পারে।

    ./gradlew lint
    
    MainActivity.kt:41: Error: Call requires API level 35 (current min is 34): java.util.List#removeFirst [NewApi]
          list.removeFirst()
    

    রানটাইম ব্যতিক্রম এবং লিন্ট ত্রুটিগুলি ঠিক করতে, Kotlin-এ removeFirst() এবং removeLast() ফাংশন কল যথাক্রমে removeAt(0) এবং removeAt(list.lastIndex) দিয়ে প্রতিস্থাপন করা যেতে পারে। আপনি যদি Android Studio Ladybug ব্যবহার করেন | 2024.1.3 বা উচ্চতর, এটি এই ত্রুটিগুলির জন্য একটি দ্রুত সমাধানের বিকল্পও প্রদান করে।

    @SuppressLint("NewApi") অপসারণ করার কথা বিবেচনা করুন এবং লিন্ট বিকল্পটি নিষ্ক্রিয় করা থাকলে lintOptions { disable 'NewApi' }

  • জাভাতে অন্যান্য পদ্ধতির সাথে সংঘর্ষ

    বিদ্যমান প্রকারগুলিতে নতুন পদ্ধতি যোগ করা হয়েছে, উদাহরণস্বরূপ, List এবং Deque । এই নতুন পদ্ধতিগুলি অন্যান্য ইন্টারফেস এবং ক্লাসে একই নাম এবং আর্গুমেন্ট প্রকারের পদ্ধতিগুলির সাথে সামঞ্জস্যপূর্ণ নাও হতে পারে। অসঙ্গতি সহ একটি পদ্ধতি স্বাক্ষর সংঘর্ষের ক্ষেত্রে, javac কম্পাইলার একটি বিল্ড-টাইম ত্রুটি আউটপুট করে। যেমন:

    উদাহরণ ত্রুটি 1:

    javac MyList.java
    
    MyList.java:135: error: removeLast() in MyList cannot implement removeLast() in List
      public void removeLast() {
                  ^
      return type void is not compatible with Object
      where E is a type-variable:
        E extends Object declared in interface List
    

    উদাহরণ ত্রুটি 2:

    javac MyList.java
    
    MyList.java:7: error: types Deque<Object> and List<Object> are incompatible;
    public class MyList implements  List<Object>, Deque<Object> {
      both define reversed(), but with unrelated return types
    1 error
    

    উদাহরণ ত্রুটি 3:

    javac MyList.java
    
    MyList.java:43: error: types List<E#1> and MyInterface<E#2> are incompatible;
    public static class MyList implements List<Object>, MyInterface<Object> {
      class MyList inherits unrelated defaults for getFirst() from types List and MyInterface
      where E#1,E#2 are type-variables:
        E#1 extends Object declared in interface List
        E#2 extends Object declared in interface MyInterface
    1 error
    

    এই বিল্ড ত্রুটিগুলি ঠিক করার জন্য, এই ইন্টারফেসগুলি বাস্তবায়নকারী ক্লাসটি একটি সামঞ্জস্যপূর্ণ রিটার্ন টাইপের সাথে পদ্ধতিটিকে ওভাররাইড করবে। যেমন:

    @Override
    public Object getFirst() {
        return List.super.getFirst();
    }
    

নিরাপত্তা

অ্যান্ড্রয়েড 15-এ এমন পরিবর্তনগুলি অন্তর্ভুক্ত রয়েছে যা অ্যাপ এবং ব্যবহারকারীদের ক্ষতিকারক অ্যাপ থেকে রক্ষা করতে সিস্টেম নিরাপত্তার প্রচার করে।

সীমাবদ্ধ TLS সংস্করণ

Android 15 restricts the usage of TLS versions 1.0 and 1.1. These versions had previously been deprecated in Android, but are now disallowed for apps targeting Android 15.

সুরক্ষিত ব্যাকগ্রাউন্ড কার্যকলাপ চালু হয়

Android 15 protects users from malicious apps and gives them more control over their devices by adding changes that prevent malicious background apps from bringing other apps to the foreground, elevating their privileges, and abusing user interaction. Background activity launches have been restricted since Android 10 (API level 29).

Other changes

In addition to the restriction for UID matching, these other changes are also included:

  • Change PendingIntent creators to block background activity launches by default. This helps prevent apps from accidentally creating a PendingIntent that could be abused by malicious actors.
  • Don't bring an app to the foreground unless the PendingIntent sender allows it. This change aims to prevent malicious apps from abusing the ability to start activities in the background. By default, apps are not allowed to bring the task stack to the foreground unless the creator allows background activity launch privileges or the sender has background activity launch privileges.
  • Control how the top activity of a task stack can finish its task. If the top activity finishes a task, Android will go back to whichever task was last active. Moreover, if a non-top activity finishes its task, Android will go back to the home screen; it won't block the finish of this non-top activity.
  • Prevent launching arbitrary activities from other apps into your own task. This change prevents malicious apps from phishing users by creating activities that appear to be from other apps.
  • Block non-visible windows from being considered for background activity launches. This helps prevent malicious apps from abusing background activity launches to display unwanted or malicious content to users.

নিরাপদ অভিপ্রায়

Android 15 introduces new optional security measures to make intents safer and more robust. These changes are aimed at preventing potential vulnerabilities and misuse of intents that can be exploited by malicious apps. There are two main improvements to the security of intents in Android 15:

  • Match target intent-filters: Intents that target specific components must accurately match the target's intent-filter specifications. If you send an intent to launch another app's activity, the target intent component needs to align with the receiving activity's declared intent-filters.
  • Intents must have actions: Intents without an action will no longer match any intent-filters. This means that intents used to start activities or services must have a clearly defined action.

In order to check how your app responds to these changes, use StrictMode in your app. To see detailed logs about Intent usage violations, add the following method:

Kotlin

fun onCreate() {
    StrictMode.setVmPolicy(VmPolicy.Builder()
        .detectUnsafeIntentLaunch()
        .build()
    )
}

Java

public void onCreate() {
    StrictMode.setVmPolicy(new VmPolicy.Builder()
            .detectUnsafeIntentLaunch()
            .build());
}

ব্যবহারকারীর অভিজ্ঞতা এবং সিস্টেম UI

অ্যান্ড্রয়েড 15-এ এমন কিছু পরিবর্তন রয়েছে যা আরও সামঞ্জস্যপূর্ণ, স্বজ্ঞাত ব্যবহারকারীর অভিজ্ঞতা তৈরি করার উদ্দেশ্যে করা হয়েছে।

উইন্ডো ইনসেট পরিবর্তন

অ্যান্ড্রয়েড 15-এ উইন্ডো ইনসেটগুলির সাথে সম্পর্কিত দুটি পরিবর্তন রয়েছে: এজ-টু-এজ ডিফল্টরূপে প্রয়োগ করা হয় এবং কনফিগারেশন পরিবর্তনগুলিও রয়েছে, যেমন সিস্টেম বারের ডিফল্ট কনফিগারেশন।

Edge-to-edge enforcement

অ্যাপ্লিকেশানগুলি যদি Android 15 (API স্তর 35) কে লক্ষ্য করে তাহলে Android 15 চালিত ডিভাইসগুলিতে ডিফল্টরূপে এজ-টু-এজ থাকে৷

একটি অ্যাপ যা Android 14 কে লক্ষ্য করে এবং একটি Android 15 ডিভাইসে এজ-টু-এজ নয়।


একটি অ্যাপ যা Android 15 (API লেভেল 35) কে লক্ষ্য করে এবং একটি Android 15 ডিভাইসে এজ-টু-এজ। এই অ্যাপটি বেশিরভাগ উপাদান 3 রচনা উপাদান ব্যবহার করে যা স্বয়ংক্রিয়ভাবে ইনসেটগুলি প্রয়োগ করে। এই স্ক্রীনটি Android 15 এজ-টু-এজ এনফোর্সমেন্ট দ্বারা নেতিবাচকভাবে প্রভাবিত হয় না।

এটি একটি ব্রেকিং পরিবর্তন যা আপনার অ্যাপের UI কে নেতিবাচকভাবে প্রভাবিত করতে পারে। পরিবর্তনগুলি নিম্নলিখিত UI অঞ্চলগুলিকে প্রভাবিত করে:

  • অঙ্গভঙ্গি হ্যান্ডেল নেভিগেশন বার
    • ডিফল্টরূপে স্বচ্ছ।
    • নীচের অফসেট অক্ষম করা হয়েছে তাই ইনসেটগুলি প্রয়োগ করা না হলে বিষয়বস্তু সিস্টেম নেভিগেশন বারের পিছনে চলে যায়৷
    • setNavigationBarColor এবং R.attr#navigationBarColor বাতিল করা হয়েছে এবং অঙ্গভঙ্গি নেভিগেশনকে প্রভাবিত করে না।
    • setNavigationBarContrastEnforced এবং R.attr#navigationBarContrastEnforced জেসচার নেভিগেশনের উপর কোন প্রভাব নেই।
  • 3-বোতাম নেভিগেশন
    • অস্বচ্ছতা ডিফল্টরূপে 80% এ সেট করা হয়েছে, সম্ভবত উইন্ডোর পটভূমির সাথে রঙের সাথে মিল রয়েছে।
    • নীচের অফসেট অক্ষম করা হয়েছে যাতে ইনসেটগুলি প্রয়োগ না করা হলে বিষয়বস্তু সিস্টেম নেভিগেশন বারের পিছনে চলে যায়৷
    • setNavigationBarColor এবং R.attr#navigationBarColor ডিফল্টরূপে উইন্ডোর পটভূমির সাথে মেলে সেট করা আছে। এই ডিফল্টটি প্রয়োগ করার জন্য উইন্ডোর পটভূমিতে অবশ্যই একটি রঙ আঁকতে হবে। এই APIটি বাতিল করা হয়েছে কিন্তু 3-বোতাম নেভিগেশনকে প্রভাবিত করে চলেছে৷
    • setNavigationBarContrastEnforced এবং R.attr#navigationBarContrastEnforced ডিফল্টভাবে সত্য, যা 3-বোতাম নেভিগেশন জুড়ে একটি 80% অস্বচ্ছ পটভূমি যোগ করে।
  • স্ট্যাটাস বার
    • ডিফল্টরূপে স্বচ্ছ।
    • শীর্ষ অফসেটটি অক্ষম করা হয়েছে তাই ইনসেটগুলি প্রয়োগ করা না হলে বিষয়বস্তু স্ট্যাটাস বারের পিছনে চলে যায়৷
    • setStatusBarColor এবং R.attr#statusBarColor বাতিল করা হয়েছে এবং Android 15-এ কোনো প্রভাব নেই।
    • setStatusBarContrastEnforced এবং R.attr#statusBarContrastEnforced বাতিল করা হয়েছে কিন্তু এখনও Android 15-এ এর প্রভাব রয়েছে।
  • ডিসপ্লে কাটআউট
    • নন-ফ্লোটিং উইন্ডোগুলির layoutInDisplayCutoutMode অবশ্যই LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS হতে হবে। SHORT_EDGES , NEVER , এবং DEFAULT ALWAYS হিসাবে ব্যাখ্যা করা হয় যাতে ব্যবহারকারীরা ডিসপ্লে কাটআউটের কারণে একটি কালো বার দেখতে না পায় এবং প্রান্ত থেকে প্রান্তে প্রদর্শিত হয়৷

নিম্নলিখিত উদাহরণটি Android 15 (API স্তর 35) লক্ষ্য করার আগে এবং পরে এবং ইনসেটগুলি প্রয়োগ করার আগে এবং পরে একটি অ্যাপ দেখায়। এই উদাহরণটি ব্যাপক নয়, এটি Android Auto এ ভিন্নভাবে প্রদর্শিত হতে পারে।

একটি অ্যাপ যা Android 14 কে লক্ষ্য করে এবং একটি Android 15 ডিভাইসে এজ-টু-এজ নয়।
একটি অ্যাপ যা Android 15 (API লেভেল 35) কে লক্ষ্য করে এবং একটি Android 15 ডিভাইসে এজ-টু-এজ। যাইহোক, অ্যান্ড্রয়েড 15 এজ-টু-এজ এনফোর্সমেন্টের কারণে স্ট্যাটাস বার, 3-বোতাম নেভিগেশন বার, বা ডিসপ্লে কাটআউট দ্বারা অনেক উপাদান লুকানো আছে। লুকানো UI এর মধ্যে রয়েছে উপাদান 2 শীর্ষ অ্যাপ বার, ফ্লোটিং অ্যাকশন বোতাম এবং তালিকা আইটেম।
একটি অ্যাপ যা Android 15 (API স্তর 35) কে লক্ষ্য করে, একটি Android 15 ডিভাইসে প্রান্ত থেকে প্রান্তে থাকে এবং ইনসেটগুলি প্রয়োগ করে যাতে UI লুকানো না হয়।
আপনার অ্যাপটি ইতিমধ্যেই এজ-টু-এজ কিনা তা পরীক্ষা করতে হবে

যদি আপনার অ্যাপটি ইতিমধ্যেই এজ-টু-এজ হয়ে থাকে এবং ইনসেটগুলি প্রয়োগ করে, তবে নিম্নলিখিত পরিস্থিতিগুলি ব্যতীত আপনি বেশিরভাগ ক্ষেত্রেই প্রভাবিত হবেন না। যাইহোক, এমনকি যদি আপনি মনে করেন যে আপনি প্রভাবিত হননি, আমরা আপনাকে আপনার অ্যাপ পরীক্ষা করার পরামর্শ দিই।

  • আপনার কাছে একটি নন-ফ্লোটিং উইন্ডো আছে, যেমন একটি Activity যা LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS এর পরিবর্তে SHORT_EDGES , NEVER বা DEFAULT ব্যবহার করে। আপনার অ্যাপ লঞ্চের সময় ক্র্যাশ হলে, এটি আপনার স্প্ল্যাশস্ক্রিনের কারণে হতে পারে। আপনি হয় কোর স্প্ল্যাশস্ক্রিন নির্ভরতাকে 1.2.0-alpha01 বা পরবর্তীতে আপগ্রেড করতে পারেন অথবা window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutInDisplayCutoutMode.always সেট করতে পারেন।
  • আবদ্ধ UI সহ নিম্ন-ট্রাফিক স্ক্রীন থাকতে পারে। এই কম পরিদর্শন করা স্ক্রীনে UI আটকানো নেই তা যাচাই করুন। নিম্ন-ট্র্যাফিক স্ক্রিনগুলির মধ্যে রয়েছে:
    • অনবোর্ডিং বা সাইন-ইন স্ক্রীন
    • সেটিংস পৃষ্ঠা
আপনার অ্যাপ ইতিমধ্যেই এজ-টু-এজ না হলে কী পরীক্ষা করবেন

যদি আপনার অ্যাপ ইতিমধ্যেই এজ-টু-এজ না হয়, তাহলে আপনি সম্ভবত প্রভাবিত হবেন। ইতিমধ্যেই এজ-টু-এজ অ্যাপ্লিকেশানগুলির জন্য পরিস্থিতিগুলি ছাড়াও, আপনার নিম্নলিখিতগুলি বিবেচনা করা উচিত:

  • যদি আপনার অ্যাপটি কম্পোজে Material 3 উপাদান ( androidx.compose.material3 ) ব্যবহার করে, যেমন TopAppBar , BottomAppBar , এবং NavigationBar , তাহলে এই উপাদানগুলি সম্ভবত প্রভাবিত হবে না কারণ তারা স্বয়ংক্রিয়ভাবে ইনসেটগুলি পরিচালনা করে৷
  • যদি আপনার অ্যাপটি রচনায় উপাদান 2 উপাদান ( androidx.compose.material ) ব্যবহার করে, তাহলে এই উপাদানগুলি স্বয়ংক্রিয়ভাবে ইনসেটগুলি পরিচালনা করে না৷ যাইহোক, আপনি ইনসেটগুলিতে অ্যাক্সেস পেতে পারেন এবং সেগুলি ম্যানুয়ালি প্রয়োগ করতে পারেন। androidx.compose.material 1.6.0 এবং পরবর্তীতে, BottomAppBar , TopAppBar , BottomNavigation এবং NavigationRail জন্য ম্যানুয়ালি ইনসেটগুলি প্রয়োগ করতে windowInsets প্যারামিটার ব্যবহার করুন। একইভাবে, Scaffold জন্য contentWindowInsets প্যারামিটার ব্যবহার করুন।
  • যদি আপনার অ্যাপটি ভিউ এবং ম্যাটেরিয়াল কম্পোনেন্ট ( com.google.android.material ) ব্যবহার করে, তবে বেশিরভাগ ভিউ-ভিত্তিক মেটেরিয়াল কম্পোনেন্ট যেমন BottomNavigationView , BottomAppBar , NavigationRailView , বা NavigationView , ইনসেটগুলি পরিচালনা করে এবং কোনও অতিরিক্ত কাজের প্রয়োজন নেই৷ যাইহোক, AppBarLayout ব্যবহার করলে আপনাকে android:fitsSystemWindows="true" যোগ করতে হবে।
  • কাস্টম কম্পোজেবলের জন্য, প্যাডিং হিসাবে ম্যানুয়ালি ইনসেটগুলি প্রয়োগ করুন। যদি আপনার বিষয়বস্তু একটি Scaffold মধ্যে থাকে, তাহলে আপনি Scaffold প্যাডিং মান ব্যবহার করে ইনসেটগুলি ব্যবহার করতে পারেন৷ অন্যথায়, একটি WindowInsets ব্যবহার করে প্যাডিং প্রয়োগ করুন।
  • আপনার অ্যাপ যদি ভিউ এবং BottomSheet , SideSheet বা কাস্টম কন্টেনার ব্যবহার করে, তাহলে ViewCompat.setOnApplyWindowInsetsListener ব্যবহার করে প্যাডিং প্রয়োগ করুন। RecyclerView এর জন্য, এই শ্রোতা ব্যবহার করে প্যাডিং প্রয়োগ করুন এবং clipToPadding="false" যোগ করুন।
আপনার অ্যাপটি অবশ্যই কাস্টম ব্যাকগ্রাউন্ড সুরক্ষা প্রদান করবে কিনা তা পরীক্ষা করতে হবে

যদি আপনার অ্যাপটি অবশ্যই 3-বোতাম নেভিগেশন বা স্ট্যাটাস বারে কাস্টম ব্যাকগ্রাউন্ড সুরক্ষা প্রদান করে, তাহলে আপনার অ্যাপটি 3-বোতামের নেভিগেশন বারের উচ্চতা বা WindowInsets.Type#statusBars পেতে WindowInsets.Type#tappableElement() ব্যবহার করে সিস্টেম বারের পিছনে একটি কম্পোজেবল বা ভিউ রাখতে হবে।

অতিরিক্ত এজ-টু-এজ রিসোর্স

ইনসেট প্রয়োগ করার বিষয়ে অতিরিক্ত বিবেচনার জন্য এজ থেকে এজ ভিউ এবং এজ টু এজ কম্পোজ গাইড দেখুন।

অপ্রচলিত API

নিম্নোক্ত APIগুলিকে অবমূল্যায়ন করা হয়েছে কিন্তু নিষ্ক্রিয় করা হয়নি:

নিম্নোক্ত API গুলি অবমূল্যায়িত এবং অক্ষম করা হয়েছে:

Stable configuration

If your app targets Android 15 (API level 35) or higher, Configuration no longer excludes the system bars. If you use the screen size in the Configuration class for layout calculation, you should replace it with better alternatives like an appropriate ViewGroup, WindowInsets, or WindowMetricsCalculator depending on your need.

Configuration has been available since API 1. It is typically obtained from Activity.onConfigurationChanged. It provides information like window density, orientation, and sizes. One important characteristic about the window sizes returned from Configuration is that it previously excluded the system bars.

The configuration size is typically used for resource selection, such as /res/layout-h500dp, and this is still a valid use case. However, using it for layout calculation has always been discouraged. If you do so, you should move away from it now. You should replace the use of Configuration with something more suitable depending on your use case.

If you use it to calculate the layout, use an appropriate ViewGroup, such as CoordinatorLayout or ConstraintLayout. If you use it to determine the height of the system navbar, use WindowInsets. If you want to know the current size of your app window, use computeCurrentWindowMetrics.

The following list describes the fields affected by this change:

elegantTextHeight অ্যাট্রিবিউট ডিফল্টে সত্য

For apps targeting Android 15 (API level 35), the elegantTextHeight TextView attribute becomes true by default, replacing the compact font used by default with some scripts that have large vertical metrics with one that is much more readable. The compact font was introduced to prevent breaking layouts; Android 13 (API level 33) prevents many of these breakages by allowing the text layout to stretch the vertical height utilizing the fallbackLineSpacing attribute.

In Android 15, the compact font still remains in the system, so your app can set elegantTextHeight to false to get the same behavior as before, but it is unlikely to be supported in upcoming releases. So, if your app supports the following scripts: Arabic, Lao, Myanmar, Tamil, Gujarati, Kannada, Malayalam, Odia, Telugu or Thai, test your app by setting elegantTextHeight to true.

elegantTextHeight behavior for apps targeting Android 14 (API level 34) and lower.
elegantTextHeight behavior for apps targeting Android 15.

জটিল অক্ষর আকারের জন্য TextView প্রস্থ পরিবর্তন

In previous versions of Android, some cursive fonts or languages that have complex shaping might draw the letters in the previous or next character's area. In some cases, such letters were clipped at the beginning or ending position. Starting in Android 15, a TextView allocates width for drawing enough space for such letters and allows apps to request extra paddings to the left to prevent clipping.

Because this change affects how a TextView decides the width, TextView allocates more width by default if the app targets Android 15 (API level 35) or higher. You can enable or disable this behavior by calling the setUseBoundsForWidth API on TextView.

Because adding left padding might cause a misalignment for existing layouts, the padding is not added by default even for apps that target Android 15 or higher. However, you can add extra padding to preventing clipping by calling setShiftDrawingOffsetForStartOverhang.

The following examples show how these changes can improve text layout for some fonts and languages.

Standard layout for English text in a cursive font. Some of the letters are clipped. Here is the corresponding XML:

<TextView
    android:fontFamily="cursive"
    android:text="java" />
Layout for the same English text with additional width and padding. Here is the corresponding XML:

<TextView
    android:fontFamily="cursive"
    android:text="java"
    android:useBoundsForWidth="true"
    android:shiftDrawingOffsetForStartOverhang="true" />
Standard layout for Thai text. Some of the letters are clipped. Here is the corresponding XML:

<TextView
    android:text="คอมพิวเตอร์" />
Layout for the same Thai text with additional width and padding. Here is the corresponding XML:

<TextView
    android:text="คอมพิวเตอร์"
    android:useBoundsForWidth="true"
    android:shiftDrawingOffsetForStartOverhang="true" />

EditText-এর জন্য স্থানীয়-সচেতন ডিফল্ট লাইন উচ্চতা

In previous versions of Android, the text layout stretched the height of the text to meet the line height of the font that matched the current locale. For example, if the content was in Japanese, because the line height of the Japanese font is slightly larger than the one of a Latin font, the height of the text became slightly larger. However, despite these differences in line heights, the EditText element was sized uniformly, regardless of the locale being used, as illustrated in the following image:

Three boxes representing EditText elements that can contain text from English (en), Japanese (ja), and Burmese (my). The height of the EditText is the same, even though these languages have different line heights from each other.

For apps targeting Android 15 (API level 35), a minimum line height is now reserved for EditText to match the reference font for the specified Locale, as shown in the following image:

Three boxes representing EditText elements that can contain text from English (en), Japanese (ja), and Burmese (my). The height of the EditText now includes space to accommodate the default line height for these languages' fonts.

If needed, your app can restore the previous behavior by specifying the useLocalePreferredLineHeightForMinimum attribute to false, and your app can set custom minimum vertical metrics using the setMinimumFontMetrics API in Kotlin and Java.

ক্যামেরা এবং মিডিয়া

Android 15 অ্যানড্রয়েড 15 বা উচ্চতরকে লক্ষ্য করে এমন অ্যাপগুলির জন্য ক্যামেরা এবং মিডিয়া আচরণে নিম্নলিখিত পরিবর্তনগুলি করে৷

অডিও ফোকাস অনুরোধের উপর সীমাবদ্ধতা

যে অ্যাপগুলি Android 15 (API স্তর 35) টার্গেট করে সেগুলিকে অবশ্যই শীর্ষ অ্যাপ হতে হবে বা অডিও ফোকাসের অনুরোধ করার জন্য একটি ফোরগ্রাউন্ড পরিষেবা চালাতে হবে৷ যদি কোনো অ্যাপ ফোকাসের অনুরোধ করার চেষ্টা করে যখন এটি এই প্রয়োজনীয়তার একটি পূরণ না করে, তাহলে কলটি AUDIOFOCUS_REQUEST_FAILED ফেরত দেয়।

আপনি অডিও ফোকাস পরিচালনা অডিও ফোকাস সম্পর্কে আরও জানতে পারেন।

নন-SDK সীমাবদ্ধতা আপডেট করা হয়েছে

Android 15-এ Android বিকাশকারীদের সাথে সহযোগিতা এবং সর্বশেষ অভ্যন্তরীণ পরীক্ষার উপর ভিত্তি করে সীমাবদ্ধ নন-SDK ইন্টারফেসের আপডেট করা তালিকা অন্তর্ভুক্ত রয়েছে। যখনই সম্ভব, আমরা নিশ্চিত করি যে আমরা নন-SDK ইন্টারফেস সীমাবদ্ধ করার আগে সর্বজনীন বিকল্পগুলি উপলব্ধ রয়েছে।

যদি আপনার অ্যাপটি Android 15 কে টার্গেট না করে, তবে এই পরিবর্তনগুলির মধ্যে কিছু আপনাকে অবিলম্বে প্রভাবিত করতে পারে না। যাইহোক, আপনার অ্যাপের টার্গেট API স্তরের উপর নির্ভর করে কিছু নন-SDK ইন্টারফেস অ্যাক্সেস করা আপনার অ্যাপের পক্ষে সম্ভব হলেও, যেকোনো নন-SDK পদ্ধতি বা ক্ষেত্র ব্যবহার করলে সবসময় আপনার অ্যাপ ভেঙে যাওয়ার উচ্চ ঝুঁকি থাকে।

আপনি যদি নিশ্চিত না হন যে আপনার অ্যাপ নন-SDK ইন্টারফেস ব্যবহার করে, তাহলে আপনি খুঁজে বের করতে আপনার অ্যাপ পরীক্ষা করতে পারেন। যদি আপনার অ্যাপ নন-SDK ইন্টারফেসের উপর নির্ভর করে, তাহলে আপনার SDK বিকল্পগুলিতে স্থানান্তরের পরিকল্পনা শুরু করা উচিত। তা সত্ত্বেও, আমরা বুঝি যে কিছু অ্যাপে নন-SDK ইন্টারফেস ব্যবহার করার জন্য বৈধ ব্যবহারের ক্ষেত্রে রয়েছে। আপনি যদি আপনার অ্যাপে একটি বৈশিষ্ট্যের জন্য একটি নন-SDK ইন্টারফেস ব্যবহার করার বিকল্প খুঁজে না পান, তাহলে আপনাকে একটি নতুন সর্বজনীন API অনুরোধ করা উচিত।

To learn more about the changes in this release of Android, see Updates to non-SDK interface restrictions in Android 15. To learn more about non-SDK interfaces generally, see Restrictions on non-SDK interfaces.