blob: 9cad395270cd71335a3ad175d51bed46cd3888c3 [file] [log] [blame]
Morten Krogh-Jespersen7a47b732021-05-11 17:32:34 +02001// Copyright (c) 2021, the R8 project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
Morten Krogh-Jespersenba2f61a2023-08-15 15:33:38 +02005package softverificationerror;
Morten Krogh-Jespersen7a47b732021-05-11 17:32:34 +02006
7import android.app.NotificationChannel;
8import android.app.NotificationManager;
9import android.os.Build;
10
11public class ApiCallerInlined {
12
13 public static void callApi(android.content.Context context) {
14 // Create the NotificationChannel, but only on API 26+ because
15 // the NotificationChannel class is new and not in the support library
16 if (Build.VERSION.SDK_INT >= 26) {
17 constructUnknownObjectAndCallUnknownMethod(context);
18 }
19 }
20
21 public static void constructUnknownObject(android.content.Context context) {
22 NotificationChannel channel =
23 new NotificationChannel("CHANNEL_ID", "FOO", NotificationManager.IMPORTANCE_DEFAULT);
24 channel.setDescription("This is a test channel");
25 }
26
27 public static void callUnknownMethod(android.content.Context context) {
28 NotificationManager notificationManager =
29 (NotificationManager) context.getSystemService(NotificationManager.class);
30 notificationManager.createNotificationChannel(null);
31 }
32
33 public static void constructUnknownObjectAndCallUnknownMethod(android.content.Context context) {
34 NotificationChannel channel =
35 new NotificationChannel("CHANNEL_ID", "FOO", NotificationManager.IMPORTANCE_DEFAULT);
36 channel.setDescription("This is a test channel");
37 NotificationManager notificationManager =
38 (NotificationManager) context.getSystemService(NotificationManager.class);
39 notificationManager.createNotificationChannel(channel);
40 }
41}