Пример #1
0
        public bool CloseLayer(long layerId)
        {
            lock (Lock)
            {
                Layer layer = GetLayerByIdLocked(layerId);

                if (layer != null)
                {
                    HOSBinderDriverServer.UnregisterBinderObject(layer.ProducerBinderId);
                }

                bool removed = _layers.Remove(layerId);

                // If the layer was removed and the current in use, we need to change the current layer in use.
                if (removed && RenderLayerId == layerId)
                {
                    // If no layer is availaible, reset to default value.
                    if (_layers.Count == 0)
                    {
                        SetRenderLayer(0);
                    }
                    else
                    {
                        SetRenderLayer(_layers.Last().Key);
                    }
                }

                return(removed);
            }
        }
Пример #2
0
        public ResultCode DestroyStrayLayer(long layerId)
        {
            lock (Lock)
            {
                Layer layer = GetLayerByIdLocked(layerId);

                if (layer == null)
                {
                    Logger.Error?.Print(LogClass.SurfaceFlinger, $"Failed to destroy stray layer {layerId} (not found)");

                    return(ResultCode.InvalidValue);
                }

                if (layer.State != LayerState.Stray)
                {
                    Logger.Error?.Print(LogClass.SurfaceFlinger, $"Failed to destroy stray layer {layerId} (permission denied)");

                    return(ResultCode.PermissionDenied);
                }

                HOSBinderDriverServer.UnregisterBinderObject(layer.ProducerBinderId);

                if (_layers.Remove(layerId))
                {
                    CloseLayer(layerId, layer);
                }

                return(ResultCode.Success);
            }
        }
Пример #3
0
        public bool CloseLayer(long layerId)
        {
            lock (Lock)
            {
                Layer layer = GetLayerByIdLocked(layerId);

                if (layer != null)
                {
                    HOSBinderDriverServer.UnregisterBinderObject(layer.ProducerBinderId);
                }

                return(_layers.Remove(layerId));
            }
        }