1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.notification; 18 19 import android.app.NotificationChannel; 20 import android.app.NotificationChannelGroup; 21 22 import java.util.ArrayList; 23 import java.util.List; 24 25 public class NotificationChannelLoggerFake implements NotificationChannelLogger { 26 static class CallRecord { 27 public NotificationChannelEvent event; CallRecord(NotificationChannelEvent event)28 CallRecord(NotificationChannelEvent event) { 29 this.event = event; 30 } 31 32 @Override toString()33 public String toString() { 34 return "CallRecord{" + 35 "event=" + event + 36 '}'; 37 } 38 } 39 40 private List<CallRecord> mCalls = new ArrayList<>(); 41 getCalls()42 List<CallRecord> getCalls() { 43 return mCalls; 44 } 45 get(int index)46 CallRecord get(int index) { 47 return mCalls.get(index); 48 } 49 50 @Override logNotificationChannel(NotificationChannelEvent event, NotificationChannel channel, int uid, String pkg, int oldImportance, int newImportance)51 public void logNotificationChannel(NotificationChannelEvent event, NotificationChannel channel, 52 int uid, String pkg, int oldImportance, int newImportance) { 53 mCalls.add(new CallRecord(event)); 54 } 55 56 @Override logNotificationChannelGroup(NotificationChannelEvent event, NotificationChannelGroup channelGroup, int uid, String pkg, boolean wasBlocked)57 public void logNotificationChannelGroup(NotificationChannelEvent event, 58 NotificationChannelGroup channelGroup, int uid, String pkg, boolean wasBlocked) { 59 mCalls.add(new CallRecord(event)); 60 } 61 62 @Override logAppEvent(NotificationChannelEvent event, int uid, String pkg)63 public void logAppEvent(NotificationChannelEvent event, int uid, String pkg) { 64 mCalls.add(new CallRecord(event)); 65 } 66 } 67