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

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

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

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

অ্যান্ড্রয়েড ১৫ অ্যান্ড্রয়েড সিস্টেমের বিভিন্ন মূল ক্ষমতা পরিবর্তন বা প্রসারিত করে।

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

We are making the following changes to foreground services with Android 15.

Data sync foreground service timeout behavior

Android 15 introduces a new timeout behavior to dataSync for apps targeting Android 15 (API level 35) or higher. This behavior also applies to the new mediaProcessing foreground service type.

The system permits an app's dataSync 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(). When Service.onTimeout() is called, the service is no longer considered a foreground service. 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 dataSync did not stop within its timeout: [component name]"

To avoid problems with this behavior change, you can do one or more 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 dataSync 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 dataSync 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 dataSync foreground service, use an alternative API.

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

Testing

To test your app's behavior, you can enable data sync 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 data_sync_fgs_timeout_duration duration-in-milliseconds

New media processing foreground service type

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

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

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

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

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

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

mediaProcessing পরিষেবার ধরন সম্পর্কে আরও তথ্যের জন্য, Android 15: মিডিয়া প্রসেসিং-এর জন্য অগ্রভাগের পরিষেবার প্রকারগুলিতে পরিবর্তনগুলি দেখুন৷

টেস্টিং

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

adb shell am compat enable FGS_INTRODUCE_TIME_LIMITS your-package-name

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

adb shell device_config put activity_manager media_processing_fgs_timeout_duration duration-in-milliseconds

Restrictions on BOOT_COMPLETED broadcast receivers launching foreground services

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

Restrictions on starting foreground services while an app holds the SYSTEM_ALERT_WINDOW permission

পূর্বে, যদি একটি অ্যাপের কাছে 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 (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() এর সাথে মিলবে বলে আশা করা উচিত নয়।

অ্যান্ড্রয়েড ১৫ (এপিআই লেভেল ৩৫) ব্যবহার করার জন্য আপনার অ্যাপের বিল্ড কনফিগারেশনে 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 ১৪ এবং তার নিচের ভার্সনে চালানো হয়, তাহলে একটি রানটাইম ত্রুটি দেখা দেয়:

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

    অ্যান্ড্রয়েড গ্রেডল প্লাগইনের বিদ্যমান NewApi লিন্ট বিকল্পটি এই নতুন এপিআই ব্যবহারগুলি ধরতে পারে।

    ./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 কম্পাইলার একটি বিল্ড-টাইম ত্রুটি আউটপুট করে। উদাহরণস্বরূপ:

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

    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
    

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

    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
    

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

    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();
    }
    

নিরাপত্তা

অ্যান্ড্রয়েড ১৫-এ এমন পরিবর্তন অন্তর্ভুক্ত রয়েছে যা সিস্টেম সুরক্ষাকে উৎসাহিত করে এবং অ্যাপ এবং ব্যবহারকারীদের ক্ষতিকারক অ্যাপ থেকে রক্ষা করতে সাহায্য করে।

সীমাবদ্ধ TLS ভার্সন

Android 15 TLS সংস্করণ 1.0 এবং 1.1 ব্যবহার সীমাবদ্ধ করে। এই সংস্করণগুলি পূর্বে অ্যান্ড্রয়েডে অবহেলিত ছিল, কিন্তু এখন Android 15 টার্গেট করা অ্যাপগুলির জন্য অননুমোদিত।

সুরক্ষিত ব্যাকগ্রাউন্ড অ্যাক্টিভিটি লঞ্চ করা হচ্ছে

অ্যান্ড্রয়েড ১৫ ব্যবহারকারীদের ক্ষতিকারক অ্যাপ থেকে রক্ষা করে এবং তাদের ডিভাইসের উপর আরও নিয়ন্ত্রণ দেয়, এমন পরিবর্তন যোগ করে যা ক্ষতিকারক ব্যাকগ্রাউন্ড অ্যাপগুলিকে অন্যান্য অ্যাপগুলিকে সামনে আনা, তাদের সুবিধাগুলি উন্নত করা এবং ব্যবহারকারীর ইন্টারঅ্যাকশনের অপব্যবহার করা থেকে বিরত রাখে। অ্যান্ড্রয়েড ১০ (এপিআই লেভেল ২৯) থেকে ব্যাকগ্রাউন্ড অ্যাক্টিভিটি লঞ্চ সীমিত করা হয়েছে।

অন্যান্য পরিবর্তন

  • ডিফল্টরূপে ব্যাকগ্রাউন্ড অ্যাক্টিভিটি লঞ্চ ব্লক করতে PendingIntent ক্রিয়েটরদের পরিবর্তন করুন । এটি অ্যাপগুলিকে দুর্ঘটনাক্রমে এমন PendingIntent তৈরি করা থেকে বিরত রাখতে সাহায্য করে যা ক্ষতিকারক ব্যক্তিদের দ্বারা অপব্যবহার করা যেতে পারে।
  • PendingIntent প্রেরক যদি অনুমতি না দেন, তাহলে কোনও অ্যাপকে ফোরগ্রাউন্ডে আনবেন না । এই পরিবর্তনের লক্ষ্য হল ক্ষতিকারক অ্যাপগুলিকে ব্যাকগ্রাউন্ডে কার্যকলাপ শুরু করার ক্ষমতার অপব্যবহার করা থেকে বিরত রাখা। ডিফল্টরূপে, অ্যাপগুলিকে টাস্ক স্ট্যাক ফোরগ্রাউন্ডে আনার অনুমতি দেওয়া হয় না যদি না স্রষ্টা ব্যাকগ্রাউন্ড অ্যাক্টিভিটি লঞ্চের সুবিধাগুলি অনুমোদন করেন অথবা প্রেরকের ব্যাকগ্রাউন্ড অ্যাক্টিভিটি লঞ্চের সুবিধা থাকে।
  • একটি টাস্ক স্ট্যাকের উপরের অ্যাক্টিভিটি কীভাবে তার কাজ শেষ করতে পারে তা নিয়ন্ত্রণ করুন । যদি উপরের অ্যাক্টিভিটি একটি কাজ শেষ করে, তাহলে অ্যান্ড্রয়েড যে টাস্কটি শেষ সক্রিয় ছিল সেখানে ফিরে যাবে। তাছাড়া, যদি একটি নন-টপ অ্যাক্টিভিটি তার কাজ শেষ করে, তাহলে অ্যান্ড্রয়েড হোম স্ক্রিনে ফিরে যাবে; এটি এই নন-টপ অ্যাক্টিভিটির সমাপ্তি ব্লক করবে না।
  • আপনার নিজের কাজে অন্যান্য অ্যাপ থেকে ইচ্ছামত কার্যকলাপ চালু করা থেকে বিরত রাখুন । এই পরিবর্তনটি ক্ষতিকারক অ্যাপগুলিকে অন্যান্য অ্যাপ থেকে আসা কার্যকলাপ তৈরি করে ব্যবহারকারীদের ফিশিং থেকে বিরত রাখে।
  • ব্যাকগ্রাউন্ড অ্যাক্টিভিটি লঞ্চের জন্য অদৃশ্যমান উইন্ডোগুলিকে বিবেচনা করা থেকে ব্লক করুন । এটি ক্ষতিকারক অ্যাপগুলিকে ব্যবহারকারীদের কাছে অবাঞ্ছিত বা ক্ষতিকারক সামগ্রী প্রদর্শনের জন্য ব্যাকগ্রাউন্ড অ্যাক্টিভিটি লঞ্চের অপব্যবহার থেকে বিরত রাখতে সহায়তা করে।

নিরাপদ উদ্দেশ্য

অ্যান্ড্রয়েড ১৫ ইনটেন্টের জন্য StrictMode চালু করেছে।

Intent ব্যবহারের লঙ্ঘন সম্পর্কে বিস্তারিত লগ দেখতে, নিম্নলিখিত পদ্ধতিটি ব্যবহার করুন:

কোটলিন

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

জাভা

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

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

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

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

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

প্রান্ত থেকে প্রান্ত প্রয়োগ

Apps are edge-to-edge by default on devices running Android 15 if the app is targeting Android 15 (API level 35).

An app that targets Android 14 and is not edge-to-edge on an Android 15 device.


An app that targets Android 15 (API level 35) and is edge-to-edge on an Android 15 device. This app mostly uses Material 3 Compose Components that automatically apply insets. This screen is not negatively impacted by the Android 15 edge-to-edge enforcement.

This is a breaking change that might negatively impact your app's UI. The changes affect the following UI areas:

  • Gesture handle navigation bar
    • Transparent by default.
    • Bottom offset is disabled so content draws behind the system navigation bar unless insets are applied.
    • setNavigationBarColor and R.attr#navigationBarColor are deprecated and don't affect gesture navigation.
    • setNavigationBarContrastEnforced and R.attr#navigationBarContrastEnforced continue to have no effect on gesture navigation.
  • 3-button navigation
    • Opacity set to 80% by default, with color possibly matching the window background.
    • Bottom offset disabled so content draws behind the system navigation bar unless insets are applied.
    • setNavigationBarColor and R.attr#navigationBarColor are set to match the window background by default. The window background must be a color drawable for this default to apply. This API is deprecated but continues to affect 3-button navigation.
    • setNavigationBarContrastEnforced and R.attr#navigationBarContrastEnforced is true by default, which adds an 80% opaque background across 3-button navigation.
  • Status bar
    • Transparent by default.
    • The top offset is disabled so content draws behind the status bar unless insets are applied.
    • setStatusBarColor and R.attr#statusBarColor are deprecated and have no effect on Android 15.
    • setStatusBarContrastEnforced and R.attr#statusBarContrastEnforced are deprecated but still have an effect on Android 15.
  • Display cutout
    • layoutInDisplayCutoutMode of non-floating windows must be LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS. SHORT_EDGES, NEVER, and DEFAULT are interpreted as ALWAYS so that users don't see a black bar caused by the display cutout and appear edge-to-edge.

The following example shows an app before and after targeting Android 15 (API level 35), and before and after applying insets. This example is not comprehensive, this might appear differently on Android Auto.

An app that targets Android 14 and is not edge-to-edge on an Android 15 device.
An app that targets Android 15 (API level 35) and is edge-to-edge on an Android 15 device. However, many elements are now hidden by the status bar, 3-button navigation bar, or display cutout due to the Android 15 edge-to-edge enforcements. Hidden UI includes the Material 2 top app bar, floating action buttons, and list items.
An app that targets Android 15 (API level 35), is edge to edge on an Android 15 device and applies insets so that UI is not hidden.
What to check if your app is already edge-to-edge

If your app is already edge-to-edge and applies insets, you are mostly unimpacted, except in the following scenarios. However, even if you think you aren't impacted, we recommend you test your app.

  • You have a non-floating window, such as an Activity that uses SHORT_EDGES, NEVER or DEFAULT instead of LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS. If your app crashes on launch, this might be due to your splashscreen. You can either upgrade the core splashscreen dependency to 1.2.0-alpha01 or later or set window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutInDisplayCutoutMode.always.
  • There might be lower-traffic screens with occluded UI. Verify these less-visited screens don't have occluded UI. Lower-traffic screens include:
    • Onboarding or sign-in screens
    • Settings pages
What to check if your app is not already edge-to-edge

If your app is not already edge-to-edge, you are most likely impacted. In addition to the scenarios for apps that are already edge-to-edge, you should consider the following:

  • If your app uses Material 3 Components ( androidx.compose.material3) in compose, such as TopAppBar, BottomAppBar, and NavigationBar, these components are likely not impacted because they automatically handle insets.
  • If your app is using Material 2 Components ( androidx.compose.material) in Compose, these components don't automatically handle insets. However, you can get access to the insets and apply them manually. In androidx.compose.material 1.6.0 and later, use the windowInsets parameter to apply the insets manually for BottomAppBar, TopAppBar, BottomNavigation, and NavigationRail. Likewise, use the contentWindowInsets parameter for Scaffold.
  • If your app uses views and Material Components (com.google.android.material), most views-based Material Components such as BottomNavigationView, BottomAppBar, NavigationRailView, or NavigationView, handle insets and require no additional work. However, you need to add android:fitsSystemWindows="true" if using AppBarLayout.
  • For custom composables, apply the insets manually as padding. If your content is within a Scaffold, you can consume insets using the Scaffold padding values. Otherwise, apply padding using one of the WindowInsets.
  • If your app is using views and BottomSheet, SideSheet or custom containers, apply padding using ViewCompat.setOnApplyWindowInsetsListener. For RecyclerView, apply padding using this listener and also add clipToPadding="false".
What to check if your app must offer custom background protection

If your app must offer custom background protection to 3-button navigation or the status bar, your app should place a composable or view behind the system bar using WindowInsets.Type#tappableElement() to get the 3-button navigation bar height or WindowInsets.Type#statusBars.

Additional edge-to-edge resources

See the Edge to Edge Views and Edge to Edge Compose guides for additional considerations on applying insets.

Deprecated APIs

The following APIs are deprecated but not disabled:

The following APIs are deprecated and disabled:

স্থিতিশীল কনফিগারেশন

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 অ্যাট্রিবিউট ডিফল্টভাবে true এ সেট করা হয়

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.

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

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

যেহেতু এই পরিবর্তনটি একটি TextView কিভাবে প্রস্থ নির্ধারণ করে তা প্রভাবিত করে, তাই যদি অ্যাপটি Android 15 (API লেভেল 35) বা তার বেশি লক্ষ্য করে তাহলে TextView ডিফল্টভাবে আরও প্রস্থ বরাদ্দ করে। আপনি TextViewsetUseBoundsForWidth API-কে কল করে এই আচরণটি সক্ষম বা অক্ষম করতে পারেন।

যেহেতু বাম প্যাডিং যোগ করার ফলে বিদ্যমান লেআউটগুলির জন্য একটি মিসলাইনমেন্ট হতে পারে, প্যাডিংটি ডিফল্টরূপে যোগ করা হয় না এমনকি Android 15 বা উচ্চতরকে লক্ষ্য করে এমন অ্যাপগুলির জন্যও। যাইহোক, আপনি setShiftDrawingOffsetForStartOverhang এ কল করে ক্লিপিং প্রতিরোধে অতিরিক্ত প্যাডিং যোগ করতে পারেন।

নিম্নলিখিত উদাহরণগুলি দেখায় কিভাবে এই পরিবর্তনগুলি কিছু ফন্ট এবং ভাষার জন্য পাঠ্য বিন্যাস উন্নত করতে পারে৷

একটি অভিশাপ ফন্টে ইংরেজি পাঠ্যের জন্য আদর্শ বিন্যাস। কিছু চিঠি ক্লিপ করা হয়েছে। এখানে সংশ্লিষ্ট XML হল:

<TextView
    android:fontFamily="cursive"
    android:text="java" />
অতিরিক্ত প্রস্থ এবং প্যাডিং সহ একই ইংরেজি পাঠ্যের জন্য বিন্যাস। এখানে সংশ্লিষ্ট XML হল:

<TextView
    android:fontFamily="cursive"
    android:text="java"
    android:useBoundsForWidth="true"
    android:shiftDrawingOffsetForStartOverhang="true" />
থাই পাঠ্যের জন্য আদর্শ বিন্যাস। কিছু চিঠি ক্লিপ করা হয়েছে। এখানে সংশ্লিষ্ট XML হল:

<TextView
    android:text="คอมพิวเตอร์" />
অতিরিক্ত প্রস্থ এবং প্যাডিং সহ একই থাই পাঠ্যের জন্য লেআউট। এখানে সংশ্লিষ্ট XML হল:

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

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

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

EditText উপাদানের প্রতিনিধিত্বকারী তিনটি বাক্স যা ইংরেজি (en), জাপানি (ja), এবং বার্মিজ (my) থেকে পাঠ্য ধারণ করতে পারে। EditText এর উচ্চতা একই, যদিও এই ভাষাগুলির একে অপরের থেকে আলাদা লাইন উচ্চতা রয়েছে।

Android 15 (API লেভেল 35) লক্ষ্য করা অ্যাপগুলির জন্য, একটি ন্যূনতম লাইন উচ্চতা এখন EditText এর জন্য নির্দিষ্ট লোকেলের রেফারেন্স ফন্টের সাথে মেলে, যা নিম্নলিখিত ছবিতে দেখানো হয়েছে:

EditText উপাদানের প্রতিনিধিত্বকারী তিনটি বাক্স যা ইংরেজি (en), জাপানি (ja), এবং বার্মিজ (my) থেকে পাঠ্য ধারণ করতে পারে। EditText এর উচ্চতায় এখন এই ভাষার ফন্টগুলির জন্য ডিফল্ট লাইনের উচ্চতা মিটমাট করার জন্য স্থান রয়েছে।

প্রয়োজনে, আপনার অ্যাপ useLocalePreferredLineHeightForMinimum অ্যাট্রিবিউটটি false নির্দিষ্ট করে পূর্ববর্তী আচরণ পুনরুদ্ধার করতে পারে এবং আপনার অ্যাপটি Kotlin এবং Java এ setMinimumFontMetrics API ব্যবহার করে কাস্টম ন্যূনতম উল্লম্ব মেট্রিক্স সেট করতে পারে।

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

অ্যান্ড্রয়েড ১৫ বা তার উচ্চতর ভার্সনের অ্যাপগুলির জন্য ক্যামেরা এবং মিডিয়া আচরণে নিম্নলিখিত পরিবর্তনগুলি আনে।

অডিও ফোকাসের অনুরোধের উপর বিধিনিষেধ

Apps that target Android 15 (API level 35) must be the top app or running a foreground service in order to request audio focus. If an app attempts to request focus when it does not meet one of these requirements, the call returns AUDIOFOCUS_REQUEST_FAILED.

You can learn more about audio focus at Manage audio focus.

আপডেট করা নন-SDK বিধিনিষেধ

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

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

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

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